Script.php: remove RESET Password stuff because there is no form with ID 'form_reset_password'
parent
bc77fa1aa4
commit
62966c82fa
45
Script.php
45
Script.php
|
@ -290,51 +290,6 @@ if (!empty($_POST["form_recover_password"])) {
|
|||
}
|
||||
}
|
||||
|
||||
// ################################ RESET Password #####################################
|
||||
|
||||
if (!empty($_POST["form_reset_password"])) {
|
||||
$password = mysqli_real_escape_string($con, $_POST["password"]);
|
||||
$token = mysqli_real_escape_string($con, $_POST["token"]);
|
||||
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
||||
$result = mysqli_query(
|
||||
$con,
|
||||
"SELECT * FROM Users_Table WHERE email='$email'"
|
||||
);
|
||||
if (mysqli_num_rows($result) == 0) {
|
||||
|
||||
echo "invalid email";
|
||||
return;
|
||||
} else {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
|
||||
$userid = $row['User_ID'];
|
||||
|
||||
$email = $row['Email'];
|
||||
$id = $row['Student_ID'];
|
||||
|
||||
$user_token = $userid * $userid * $userid + $userid * 0.00343;
|
||||
if ($user_token == $token) {
|
||||
// Password Update
|
||||
|
||||
// Password Update
|
||||
$hashed_password = hash('sha512', $password);
|
||||
$sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID='$userid';";
|
||||
if ($con->query($sql) === TRUE) {
|
||||
|
||||
error_reporting(0);
|
||||
|
||||
$_SESSION["info_login"] = " Password changed successfully , you can login now with your new password ";
|
||||
header("Location: index.php");
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . $con->error;
|
||||
}
|
||||
} else {
|
||||
echo "Invalid Token ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ############################### CREATE Lecturer/TA USER ##################################
|
||||
if (!empty($_POST["form_createlecturer"])){
|
||||
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
||||
|
|
Loading…
Reference in New Issue