When I run this page, I have no errors until it comes to this if statement. Is there anything wrong in my coding, besides it being a little sloppy?
I 3 if/else statements in the same file. They are:
if($_GET[‘a’] == ‘email’) {}
if($_GET[‘a’] == ‘recover’) {}
if($_GET[‘a’] == ‘reset’) {}
All the other ones work, except for when I try to execute the reset page.
if ($_GET['a'] == 'reset') {
$id = $_POST['id'];
$verification = $_POST['verification'];
$newpassword = md5($_POST['newpassword']);
$newpasswordagain = md5($_POST['newpasswordagain']);
dbconnect();
$sql = "SELECT * FROM users WHERE id = '$id' AND verification = '$verification'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if ($count == 0) {
echo 'Error 1';
} else {
if ($newpassword != $newpasswordagain) {
echo 'Sorry, your passwords did not match.';
} else {
$sql = "UPDATE users SET password = '$newpassword' WHERE id = '$id'";
$result = mysql_query($sql);
if (!$result) {
echo 'Error 2';
} else {
echo 'Thank you, your password has been changed!';
}
}
}
mysql_close();
}