-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_password.php
176 lines (151 loc) · 6.47 KB
/
reset_password.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
session_start();
include 'header.php';
if (!isset($_SESSION['user_id'])) {
echo("<script>location.href = '" . $base_url . "signin.php';</script>");
} else {
$obj1 = new commonFunctions();
$dbh = $obj1->dbh;
$status = false;
$row = '';
$user_id=$_SESSION['user_id'];
$query = $dbh->prepare("select Password from pig_user where user_id=:user_id");
$query->bindParam(":user_id",$user_id);
$query->execute();
$counts_questions = $query->rowCount();
if ($query->rowCount() > 0) {
$rows = $query->fetch(PDO::FETCH_ASSOC);
} else {
$rows = array();
}
}
?>
<!-----body section---->
<div class="ndiv body-section">
<div class="ndiv image-baaner">
<p class="pmzero page-title">Change Password</p>
</div>
<div class="ndiv primary-center-holder">
<div class="ndiv primary-center-in">
<div class="ndiv fileds-section">
<div class="ndiv halfsectionoregister">
<div class="ndiv files-of-registration" page="register">
<form action="javascript:void(0);" id="form_register" name="form_register" method="POST" onsubmit="return update_password();">
<div class="ndiv filelds-holder">
<input class="register-fields" placeholder="Current password" type="text" id="old_password" name="old_password">
<input class="register-fields" placeholder="Password" type="Password" id="txtpassword" name="txtpassword">
<input class="register-fields" placeholder="Confirm password" type="Password" id="txtcpassword" name="txtcpassword">
<button type="submit" class="get-my-cash-offer">
Update Password
</button>
<input type="hidden" value="<?php echo $rows['Password'] ?>" id="old_pwd" name="old_pwd">
</div>
</form>
</div>
</div>
<div class="ndiv halfsectionoregister">
<div class="ndiv image-with-socio">
<div class="ndiv image-with-socio-in">
<img class="img-responsive pig-to-sign" alt="pig on signup" src="<?php echo $assets; ?>image/signinpig.png" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!----/body section----->
<script>
function update_password()
{
if ($('#old_password').val() == '')
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Please Enter Current password');
$('#old_password').css("border", "1px solid red");
setTimeout(function () {
$('#old_password').css("border", "none");
}, 3000);
$('#old_password').focus();
return false;
}
if ($('#txtpassword').val() == '')
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Please enter the new password');
$('#txtpassword').css("border", "1px solid red");
setTimeout(function () {
$('#txtpassword').css("border", "none");
}, 3000);
$('#txtpassword').focus();
return false;
}
if ($('#txtcpassword').val() == '')
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Please confirm the new password');
$('#txtcpassword').css("border", "1px solid red");
setTimeout(function () {
$('#txtcpassword').css("border", "none");
}, 3000);
$('#txtcpassword').focus();
return false;
}
if (($('#txtpassword').val() != $('#txtcpassword').val()))
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Password mismatched');
$('#txtpassword').css("border", "1px solid red");
setTimeout(function () {
$('#txtpassword').css("border", "none");
}, 3000);
$('#txtpassword').focus();
$('#txtcpassword').css("border", "1px solid red");
setTimeout(function () {
$('#txtcpassword').css("border", "none");
}, 3000);
return false;
}
$.ajax({
type: "POST",
data: $('#form_register').serialize(),
url: "<?php echo $base_url; ?>update_password_proc.php",
success: function (result) {
if(result==1)
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Password Changed Succesfully');
setTimeout(function () {
window.location.href = "<?php echo $base_url; ?>profile.php";
}, 2000);
return false;
}
else
{
$('.yello-menu').trigger('click');
$('.popup-header').html('');
$('.popup-message').html('');
$('.popup-header').html('NOTIFICATION');
$('.popup-message').html('Current password is not correct');
return false;
}
}
});
}
</script>
<?php include 'footer.php'; ?>