-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer_pass_change.php
118 lines (69 loc) · 2.04 KB
/
customer_pass_change.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<html>
<head><title>Change Password</title>
<link rel="stylesheet" type="text/css" href="css/customer_pass_change.css"/>
<style>
#customer_profile .link3{
background-color: rgba(5, 21, 71,0.4);
}
</style>
</head>
<body>
<?php
include 'header.php';
include 'customer_profile_header.php';
?>
<?php
if($_SESSION['customer_login'] != true)
{
header('location:customer_login.php');
}
?>
<div class="cust_passchng_container">
<form method="post">
<br><br><input type="password" name="oldpass" placeholder="Old Password" required><br>
<input type="password" name="cnfrm" placeholder="Confirm old Password" required><br>
<input type="password" name="newpass" placeholder="New Password" required><br>
<input type="submit" name="change_pass" placeholder="Old Password"><br><br>
</form>
</div>
<?php include 'footer.php'; ?>
</body>
</html>
<?php
if(isset($_POST['change_pass'])){
$oldpass= $_POST['oldpass'];
$cnfrm= $_POST['cnfrm'];
$newpass= $_POST['newpass'];
include 'db_connect.php';
$customer_id=$_SESSION['customer_Id'];
$sql="SELECT Password from bank_customers WHERE Customer_ID='$customer_id' ";
if(!$result=$conn->query($sql)){
echo "Error:1 " . $sql . "<br>" . $conn->error;
}
$row = $result->fetch_assoc();
if($oldpass == $cnfrm){
if($row['Password'] == $oldpass ){
$sql2="UPDATE bank_customers SET Password='$newpass' WHERE bank_customers.Customer_ID=$customer_id ";
$conn->query($sql2);
if($result=$conn->query($sql2)== TRUE){
echo '<script>alert("Password Changed Successfully!")</script>';
}
}
else
{
if($row['Password'] != $oldpass ){
echo '<script>alert("Please enter correct old password")</script>';
}
}
}
else
{
if($oldpass != $cnfrm){
echo '<script>alert("Two errors\n1. Old password and Confirm Password is different!\n2. Old password is wrong")</script>';
}
else{
echo '<script>alert("Old password and Confirm Password is different!")</script>';
}
}
}
?>