-
Notifications
You must be signed in to change notification settings - Fork 1
/
changepsw.php
159 lines (146 loc) · 3.89 KB
/
changepsw.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
<?php
include('comman/connect.php');
include('include/main.php');
include('include/header.php');
if(isset($_SESSION['user'])){
$user_ses=$_SESSION['user'];
}
else
{
echo"<script>window.location.href='SignIn.php';</script>";
}
?>
<style type="text/css">
#dvPreview img
{
width: 180px;
height: 180px;
border-radius: 100%;
}
#page_head
{
min-height: 80px;
background: #fff; /* For browsers that do not support gradients */
background: -webkit-radial-gradient(circle, #ddd,#f5f5f5); /* Safari */
background: -moz-radial-gradient(circle, #ddd,#f5f5f5); /* Safari */
background: -o-radial-gradient(circle, #ddd,#f5f5f5); /* Safari */
text-align: center;
font-size: 1.3em;
line-height: 80px;
color: #444;
font-family: 'Saira Semi Condensed', sans-serif;
font-weight: bold;
}
.page_details
{
background: #fff;
margin-top: 20px;
padding:20px;
border-radius: 4px;
border: 1px solid #ddd;
}
.page_title
{
width: 100%;
min-height: 60px;
font-family: 'Saira Semi Condensed', sans-serif;
font-size: 2.5em;
font-weight: bold;
color: #444;
}
.backbox{margin-bottom: 30px;}
.pic
{
width: 170px;
height: 170px;
border-radius: 100%;
}
.pic img
{
width: 170px;
height: 170px;
border-radius: 100%;
}
</style>
<div id="page_head">
<a href="index">Home</a> / Change Password
</div>
<div class="container page_details backbox">
<div class="row">
<div class="col-sm-6">
<div class="page_title">Change Password</div>
<div class="contact_form">
<form role="form" action="#" method="post">
<div class="form-group col-sm-10">
<label for="name">Old Password</label>
<input type="password" class="form-control input" name="opsw" placeholder="Enter Old Password..." required>
</div>
<div class="form-group col-sm-10">
<label for="name">New Password</label>
<input type="password" class="form-control input" name="npsw" placeholder="Enter New Password..." required>
</div>
<div class="form-group col-sm-10">
<label for="name">Confirm Password</label>
<input type="password" class="form-control input" name="cpsw" placeholder="Enter Confirm Password..." required>
</div>
<div class="form-group col-lg-4">
<label for="name"></label>
<input type="submit" class="form-control btn btn-primary input_batt" name="change" value="Change">
</div>
<div class="form-group col-lg-10">
<div id="error"></div>
</div>
</form>
<?php
if(isset($_POST['change']))
{
extract($_POST);
$row=mysqli_fetch_array($con->query("select * from registration where email='$user_ses'"));
if($npsw==$cpsw)
{
$npsw=password_hash($npsw, PASSWORD_DEFAULT);
if(password_verify($opsw, $row['Password']))
{
$sql="update registration set password='$npsw' where email='$user_ses'";
$con->query($sql);
?>
<script type="text/javascript">
document.getElementById('error').innerHTML="Password Updated";
error.style.padding = "20px";
error.style.color = "red";
error.style.border = "1px solid red";
</script>
<?php }
else
{?>
<script type="text/javascript">
document.getElementById('error').innerHTML="Old Password Not Match";
error.style.padding = "20px";
error.style.color = "red";
error.style.border = "1px solid red";
</script>
<?php }
}
else
{?>
<script type="text/javascript">
document.getElementById('error').innerHTML="New and Confirm Password Not Match";
error.style.padding = "20px";
error.style.color = "red";
error.style.border = "1px solid red";
</script>
<?php }
}
?>
</div>
</div>
<div class="col-sm-6">
</div>
</div>
</div>
<?php
include("include/footerstrip.php");
?>
<script type="text/javascript" src="js/bootstrap.js"></script>
</body>
</html>