-
Notifications
You must be signed in to change notification settings - Fork 0
/
change-password.php
215 lines (191 loc) · 5.96 KB
/
change-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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?php
include('constant.php');
?>
<!DOCTYPE php>
<php xmlns="http://www.w3.org/1999/xphp">
<head>
<meta http-equiv="content-type" content="text/php; charset=UTF-8">
<title>Admin - Indo Roots</title>
<link rel="stylesheet" href="CSS/style.css">
<!--[if lt IE 9]>
<script type="text/javascript" src="php5.js"></script>
<![endif]-->
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix1.js"></script>
<![endif]-->
<!-- Menu start --------------->
<link href="menu/quickmenu0.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="menu/quickmenu0.js"></script>
<!-- Menu End --------------->
</head>
<body>
<header>
<div id="wrap">
<div class="logo"><img src="images/logo.png" border="0"></div>
<div class="topmenu">
<ul>
<li><a> </a></li>
<li><a href="change-password.php">Change Password</a> |</li>
<li><a href="index.php"><img src="images/logout.png" width="16" height="16" border="0" align="absmiddle"> Logout</a></li>
</ul>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</header>
<nav>
<ul id="qm0" class="qmmc" >
<li><a href="admin.php">Dashboard</a></li>
<li><a href="#">Product</a>
<ul>
<li><a href="add-category.php">Add Category</a></li>
<li><a href="add-sub-category.php">Add Sub Category</a></li>
<li><a href="product.php">Add Product</a></li>
</ul>
</li>
<!-- <li><a href="#">CCTV</a>
<ul>
<li><a href="product-brand.php">Add Brand</a></li>
<li><a href="cctv.php">Add Product</a></li>
</ul>
</li> -->
</ul>
</nav>
<?php
if(isset($_SESSION['user-not-found']))
{
echo $_SESSION['user-not-found'];
unset($_SESSION['user-not-found']);
}
if(isset($_SESSION['pwd-not-match']))
{
echo $_SESSION['pwd-not-match'];
unset($_SESSION['pwd-not-match']);
}
if(isset($_SESSION['change-pwd']))
{
echo $_SESSION['change-pwd'];
unset($_SESSION['change-pwd']);
}
?>
<?php
if(isset($_GET['id']))
{
$id=$_GET['id'];
}
?>
<form action="" method="POST">
<table >
<div id="wrap" >
<section class="bodymain" style="min-height:580px;">
<aside class="middle-container">
<div class="admin-inr"><br>
<div class="form-outer" style="margin-left:320px; width:500px;">
<h1>Change Password</h1>
<div class="contact-row">
<div class="name">Current Password</div>
<div class="txtfld-box">
<input type="text" name="current_password">
</div>
<div class="req-field"> This Field Required </div>
</div>
<div class="clear"></div>
<div class="contact-row">
<div class="name">New Password</div>
<div class="txtfld-box">
<input type="text" name="new_password">
</div>
</div>
<div class="clear"></div>
<div class="contact-row">
<div class="name">Confirm Password</div>
<div class="txtfld-box">
<input type="password" name="confirm_password">
</div>
</div>
<div class="clear"> </div>
<div class="contact-row">
<div class="name" style="float:right; width:1px;"> </div>
<div style="background:none; border:none; float:left;">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="submit" class="btn" name="Submit" value="Change Password">
<br>
</div>
</div>
<?php
$sql = "SELECT * from tbl_admin";
$res = mysqli_query($con,$sql);
if($res==TRUE)
{
$count = mysqli_num_rows($res);
$sn=1;
if($count>0)
{
while($rows=mysqli_fetch_assoc($res))
{
$id=$rows['id'];
$Email=$rows['Email'];
?>
<tr>
<td><?php echo $sn++; ?>.</td>
<td><?php echo $Email; ?></td>
<td>
<a href="change-password.php?id=<?php echo $id; ?>" class="btn">Change Password</a>
</td>
</tr>
<?php
}
}
else
{
//We Do not have Data in Database
}
}
?>
<?php
if(isset($_POST['Submit']))
{
$id=$_POST['id'];
$current_password = $_POST['current_password'];
$new_password = $_POST['new_password'];
$confirm_password = $_POST['confirm_password'];
$sql = "SELECT * FROM tbl_admin WHERE id=$id AND Password='$current_password'";
$res = mysqli_query($con, $sql);
if($res==true)
{
$count=mysqli_num_rows($res);
if($count==1)
{
if($new_password==$confirm_password)
{
$sql = "UPDATE tbl_admin SET
Password='$new_password'
WHERE id=$id
";
$res = mysqli_query($con, $sql);
}
}
}
}
?>
</table>
</form>
<div class="clear"></div>
</section>
</div>
<div class="clear"></div>
</div>
</div>
<footer>
<footer class="whitefoter">
<div class="whitefooter-cont">
<div style="float:left;">Copyright © Brilliance GPS Tracking. All Rights Reserved.</div>
<a href="https://www.akswebsoft.com/" target="_blank" style="float:right;">
<img src="images/akslogo.png" alt="AKS Websoft Consulting Pvt. Ltd." title="AKS Websoft Consulting Pvt. Ltd."></a>
<div class="clear"></div>
</div>
</footer>
</footer>
</body>
</php>