<?php
require_once '../../library/config.php';
require_once '../library/functions.php';
require_once '../library/logged.php';
require_once '../../library/validation.php';
require_once '../library/encryption.php';

if (isset($_POST['uid'])){
	$id = isNumber(trim($_POST['uid']));
	$new_salt = getRandomString();
	$new_pass = hash_pw($_POST['n_password'], $new_salt);
	$new_email = isEmail($_POST['n_email']);
	
	mysql_query("UPDATE `".TBL_USER."` SET `password` = '$new_pass', `salt` = '$new_salt', `email` = '$new_email' WHERE `uid` = '$id'", $connePaper);

?>
<b style="color:red;">更新成功!!! </b>

<script type="text/javascript">
	setTimeout(function(){location.reload()}, 1000);
</script>
<?php
}
mysql_close($connePaper);

?>