From 088ab3d0faa2061077d149ff08f459e3ae9f5d9f Mon Sep 17 00:00:00 2001 From: Samantha <37825989+Samrusike@users.noreply.github.com> Date: Fri, 25 Dec 2020 22:36:45 +0800 Subject: [PATCH] Update Script.php When a student enters a student number without the email he/she can not recover their password unless the enter both details and if not all details are correct the following error messages will be displayed; "Invalid student number" or "Invalid email address". These error messages will be displayed on the same page without navigating to the next page as before. Line 222 - 224 and 230 - 232. On Line 246 - 247 after resetting your password the recover buttons navigates direct to the signup.php where you can create a new account. --- Script.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Script.php b/Script.php index d674a11..93c0f2b 100644 --- a/Script.php +++ b/Script.php @@ -219,13 +219,17 @@ if (!empty($_POST["frm_recover_password"])) { // validate student number if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) { - echo "Invalid student number."; + $_SESSION["info_recover_password"]="Invalid student number."; + #echo "Invalid student number."; + header("Location: recover_password.php"); return; } // validate email if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - echo "Invalid email address."; + $_SESSION["info_recover_password"]="Invalid email address."; + // echo "Invalid email address."; + header("Location: recover_password.php"); return; } @@ -239,8 +243,7 @@ if (!empty($_POST["frm_recover_password"])) { } else { $result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'"); - $_SESSION["info_recover_password"] = "Reset done. Please go to the sign up page and sign up again."; - header("Location: recover_password.php"); + header("Location: signup.php"); } }