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.SIMPLICITY_link
parent
3ab9c33e8b
commit
088ab3d0fa
11
Script.php
11
Script.php
|
@ -219,13 +219,17 @@ if (!empty($_POST["frm_recover_password"])) {
|
||||||
|
|
||||||
// validate student number
|
// validate student number
|
||||||
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate email
|
// validate email
|
||||||
if (!filter_var($email, FILTER_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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +243,7 @@ if (!empty($_POST["frm_recover_password"])) {
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'");
|
$result = mysqli_query($con, "DELETE FROM users_table WHERE Email='$email' and Student_ID='$student_id'");
|
||||||
$_SESSION["info_recover_password"] = "<b>Reset done. Please go to the sign up page and sign up again</b>.";
|
header("Location: signup.php");
|
||||||
header("Location: recover_password.php");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue