include('header.php');
foreach($_POST as $key => $value) {
$sec[$key] = filter($value);
}
if(isset($_POST['change_pass'])){
if (!checkPwd($_POST['password'],$_POST['password2'])) {
$mesaj = "
ERROR: Passwords are wrong or do not match!
";
}else{
$passa = $_POST['password'];
$passc = MD5($passa);
mysql_query("UPDATE `users` SET `pass`='{$passc}', `passdecoded`='{$passa}' WHERE `id`='{$data->id}'");
$mesaj = "Password successfully changed!
";
}}
if(isset($_POST['change_email'])){
$check = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `email`='{$sec['email']}'"));
if (!isEmail($_POST['email'])) {
$mesaj = "ERROR: Please enter a valid email address!
";
}else if($check > 0){
$mesaj = "ERROR: Email address already registered!
";
}else{
mysql_query("UPDATE `users` SET `email`='{$sec['email']}' WHERE `id`='{$data->id}'");
$mesaj = "Email successfully changed!
";
}}
?>
login)) {?>
Edit Account
echo $mesaj;?>
}else{?>}?>