-
Notifications
You must be signed in to change notification settings - Fork 1
/
change_s_pwd.php
43 lines (40 loc) · 1.45 KB
/
change_s_pwd.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
43
<?php
// $a = $_SERVER['HTTP_REFERER'];
// if (strpos($a, '/e-has/') !== false) {
// } else {
// header("Location: ./");
// }
?>
<?php
// include 'index.php';
include './include/db_conn.php';
$key = rtrim($_POST['login_key']);
$pass = rtrim($_POST['pwfield']);
$user_id_auth = rtrim($_POST['login_id']);
$passconfirm= rtrim($_POST['confirmfield']);
if($pass==$passconfirm){
if (isset($user_id_auth) && isset($pass) && isset($key)) {
$sql = "SELECT * FROM admin WHERE username='$user_id_auth' and securekey='$key'";
$result = mysqli_query($con, $sql);
$count = mysqli_num_rows($result);
if ($count == 1) {
mysqli_query($con, "UPDATE admin SET pass_key='$pass' WHERE username='$user_id_auth'");
echo "<html><head><script>alert('Password Updated ,Login Again ');</script></head></html>";
echo "<meta http-equiv='refresh' content='0; url=index.php'>";
} else {
echo "<html><head><script>alert('Change Unsuccessful');</script></head></html>";
echo "<meta http-equiv='refresh' content='0; url=index.php'>";
}
} else {
echo "<html><head><script>alert('Change Unsuccessful');</script></head></html>";
echo "<meta http-equiv='refresh' content='0; url=index.php'>";
}
}
else{
echo "<html><head><script>alert('Confirm Password Mismatch');</script></head></html>";
echo "<meta http-equiv='refresh' content='0; url=forgot_password.php'>";
}
?>
<center>
<img src="loading.gif">
</center>