-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin_update_pass.php
62 lines (41 loc) · 1.15 KB
/
admin_update_pass.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
session_start();
$mail=$_SESSION['alogin'];
$con=mysqli_connect("localhost","root","","organic_shop_db")or die ("Couldn't connect");
if(isset($_POST["submitp"]))
{
$oldpassword=$_POST["oldpassword"];
$newpassword=$_POST["password"];
$disp="SELECT * FROM tbl_login where tbl_login.email='$mail'";
$disp_result=mysqli_query($con,$disp);
while($row=mysqli_fetch_array($disp_result))
{
$oldpass=$row['password'];
if((strcmp($oldpassword, $oldpass) == 0))
{
$q_update="UPDATE tbl_login SET password='$newpassword' WHERE email='$mail' ";$q_update="UPDATE tbl_login SET password='$newpassword' WHERE email='$mail' ";
if(mysqli_query($con,$q_update)==TRUE)
{
echo "<script type='text/javascript'>
alert('Password updated successfully');
window.location='admin_home.php';
</script>";
}
else
{
echo "<script type='text/javascript'>
alert('not updated');
window.location='admin_update.php';
</script>";
}
}
else
{
echo "<script type='text/javascript'>alert('The old password is wrong');
window.location='admin_update.php';</script>";
//header('Location:new_register.php');
break;
}
}
}
?>