-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForgot_Password.php
More file actions
26 lines (20 loc) · 883 Bytes
/
Copy pathForgot_Password.php
File metadata and controls
26 lines (20 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include "connection.php";
if (isset($_POST["forgotBtn"])) {
if ($_POST["newPassword"] == $_POST["confirmPassword"]) {
$query = "SELECT * FROM users WHERE email = '$_POST[forgotEmail]'";
$result = mysqli_query($connection, $query);
if ($result->num_rows > 0) {
$query1 = "UPDATE users SET password = '$_POST[newPassword]' WHERE email = '$_POST[forgotEmail]'";
$result1 = mysqli_query($connection, $query1);
header("location:Forgot_Password_Form.php?success=Password changed successfully.");
} else {
header("location:Forgot_Password_Form.php?error=Email does not exist.");
}
} else {
header("location:Forgot_Password_Form.php?error=New Password and Confirm Password are not same.");
}
} else {
header("location:Login_Form.php");
}
?>