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

<?php
/**
 * User has submitted form without errors and user's
 * account has been edited successfully.
 */
if(isset($_SESSION['useredit'])){
   unset($_SESSION['useredit']);
   
   echo "<h1>You Have Successfully Updated Your Account</h1>";
   echo "<a href=\"index.php\">Go Back To Main Page</a>";
}
else{

	if($form->num_errors > 0){
		 echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font><br>";
	}
?>
<form action="process.php" method="POST">
<h1>Password Change</h1>
If you wish to change your password, please fill out the following fields.
If you are not needing to change your password, you may leave this section blank.
<br>
<br>
Current Password:<br>
<input type="password" name="curpass" maxlength="30" size="50" value="<?php echo $form->value("curpass"); ?>"> <?php echo $form->error("curpass"); ?><br><br>
New Password:<br>
<input type="password" name="newpass" maxlength="30" size="50" value="<?php echo $form->value("newpass"); ?>"> <?php echo $form->error("newpass"); ?><br><br>
<h1>General Settings</h1>
<input type="checkbox" name="autoaccept" value="1"<?php if($session->userinfo['autoaccept_buddies'] == 1) echo " checked"; ?>/> <b>Automatically accept new buddy requests</b><br>
<input type="checkbox" name="emailaboutbuddies" value="1"<?php if($session->userinfo['emailabout_buddies'] == 1) echo " checked"; ?>/> <b>Send me e-mail notifications about buddy requests</b><br><br>
Note: if 'Automatically accept new buddy requests' is checked, you will not receive e-mail notifications regarding buddy requests, and the above setting will be ignored.<br><br>
Email:<br><input type="text" name="email" maxlength="50" size="75" value="<?php
if($form->value("email") == ""){
   echo $session->userinfo['email'];
}else{
   echo $form->value("email");
}
?>"> <?php echo $form->error("email"); ?><br><br>
<input type="hidden" name="subedit" value="1">
<input type="submit" value="Confirm and Save Account Settings">
</form>
<br><hr>
<form action="process.php" method="POST">
<h1>Account Removal</h1>
If you would like to close your account at the <?php echo UNIVERSE_ID; ?> universe, click the button below.
<br><b>This action can not be undone!</b><br><br>
<input type="hidden" name="subdelete" value="1">
<input type="button" value="Delete My Account" onclick="if(confirmSubmit('Are you sure you want to delete your account?')) { if(confirmSubmit('Last warning! This cannot be undone! ARE YOU SURE?')) { submit(); } }">
</form>

<?php
}
?>