-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgetpw_change.handle.php
42 lines (34 loc) · 1.46 KB
/
forgetpw_change.handle.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
session_start ();
require_once('setting/server_config.php');
$AccountTable_name= "useraccount";
$password = $_REQUEST["password"];
$confirmPassword = $_REQUEST["confirmPassword"];
$useremail=$_REQUEST["Email"];
$Verification = $_REQUEST["verification_code"];
$retverification = null;
$result = mysqli_query ($conn, "SELECT * FROM $AccountTable_name WHERE User_email ='$useremail'");
while ( $row = mysqli_fetch_array ( $result ) ) {
$retverification = $row ["User_verification"];
}
if (is_null ( $retverification )) {
echo "<script>alert('didn't get a verification code from database'); window.location.href='forgetpw_change.php' </script>";
exit();
}
if ($Verification != $retverification) {
echo "<script>alert('Incorrect Verification Code, please try again'); window.location.href='forgetpw_change.php' </script>";
exit();
}
if ($password != $confirmPassword) {
echo "<script>alert('Two password is not the same,they are $password and $confirmPassword '); window.location.href='forgetpw_change.php' </script>";
exit();
}
if( mysqli_query ($conn, "UPDATE $AccountTable_name SET User_Password='$password' WHERE User_email='$useremail' " )){
echo "<script>alert('Sueecss, please signin'); window.location.href='index.php' </script>";
}else{
echo "<script>alert('something went wrong'); window.location.href='index.php' </script>";
}
mysqli_close ( $conn );
header('Location: signin_front.php');
echo "password change successfully";
?>