<?php
	$break = explode('/', $_SERVER["SCRIPT_NAME"]);
	if($break[count($break) - 1] != "index.php") { header("Location: ../index.php"); exit(); } 
?>
			<div class="componentheading">Create Your Universal Unreal Account</div>
			<div class="module_menu">
				<div>
					<div>
						<div>
							<h3>Create An Account</h3>

<?php
if(isset($_SESSION['regsuccess'])){
   /* Registration was successful */
   if($_SESSION['regsuccess']){
      echo "<h1>Registered!</h1>";
      echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database.<br>You may now log in to your account from the 'Login Status' box on the right.<br><br>To begin using Universal Unreal, please follow the steps located in the 'Help &amp; How To Use' guide. A link to that guide is located in the menu on the left side of this page.</p>";
   }
   /* Registration failed */
   else{
      echo "<h1>Registration Failed</h1>";
      echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
          ."could not be completed.<br>Please try again at a later time.</p>";
   }
   unset($_SESSION['regsuccess']);
   unset($_SESSION['reguname']);
}
/**
 * The user has not filled out the registration form yet.
 * Below is the page with the sign-up form, the names
 * of the input fields are important and should not
 * be changed.
 */
else{


echo "<h1>Register for Universal Unreal Account</h1>";

if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#000000\">".$form->num_errors." error(s) found</font><br><br>";
}

echo "<form action=\"process.php\" method=\"POST\">\n";
echo "When you register for Universal Unreal, <b>do not register with your clan tag</b>. For example '[GiS]Regan'\n";
echo "should be registered as 'Regan'. Those that register with a clan tag in their username could have their\n";
echo "accounts deleted for not abiding by this rule.<br><br>\n";
echo "Username:<br><input type=\"text\" name=\"user\" maxlength=\"30\" value=\"". $form->value("user") ."\"> ". $form->error("user") ."<br><br>\n";
echo "Password:<br><input type=\"password\" name=\"pass\" maxlength=\"30\" value=\"". $form->value("pass") ."\"> ". $form->error("pass") ."<br><br>\n";
echo "Email:<br><input type=\"text\" name=\"email\" maxlength=\"50\" value=\"". $form->value("email") ."\"> ". $form->error("email") ."<br>\n";
echo "<br>In the event that you forget your password, you will have to answer a secret question before a new password is sent to you.<br><br>\n";
echo "Secret Question:<br><input type=\"text\" name=\"secretq\" size=\"50\" maxlength=\"100\" value=\"". $form->value("secretq") ."\"> ". $form->error("secretq") ."<br>\n";
echo "Answer:<br><input type=\"text\" name=\"answerq\" size=\"50\" maxlength=\"100\" value=\"". $form->value("answerq") ."\"> ". $form->error("answerq") ."<br>\n";
echo "<input type=\"hidden\" name=\"subjoin\" value=\"1\">\n";
echo "<input type=\"submit\" value=\"Register\"><br>\n";
echo "Please click 'Register' only one time and remain patient while your registration processes.\n";
echo "</form>\n";


}
?>
						</div>
					</div>
				</div>
			</div>