Password Reset
connect_errno) {
echo "
MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}
"; exit(); } //find user in db, based on email $sql = "SELECT * from users WHERE email LIKE '{$email}' LIMIT 1"; $result = $mysqli->query($sql); if ($result->num_rows != 1) { echo "Error: Email does not exist
"; } else { //update user password $upd = $mysqli->query("UPDATE users SET password = '{$password}' WHERE email LIKE '{$email}'"); //redirect to login redirect_to("login.php?msg=Password updated successfully"); } } //message if(isset($_GET['msg'])) { echo "".$_GET['msg']."
"; } ?>