-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdmin_Change_Password.php
192 lines (162 loc) · 7.26 KB
/
Admin_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
<?php
require "Connection.php";
require "Input_Validate.php";
?>
<?php
session_start();
if(!($_SESSION['admin_id']))
{
echo '<script type="text/javascript"> alert("Please login to continue.") </script>';
echo '<script type="text/javascript"> location.href="./Admin_Login.php" </script>';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>FRIENDZY | Admin Home</title>
<style type="text/css">
.workarea { background-color: rgba(0,0,0,0.7); height: 490px; width: 800px; margin-left: 300px;
margin-top: 10px;}
.panel { background-color: rgba(0,0,0,0.85); height: 80px; width: 800px; }
.change { height: 310px; width: 700px; background-color: rgba(0,0,0,0.65); margin: 50px;
border-radius: 10px;}
.panel-label { color: white; font-size: 22px; font-family: Bookman Old Style; padding-top: 10px;}
.request { height:70px; width: 780px; background-color: rgba(0,0,0,0.7); margin-top: 10px;
margin-left: 10px; border-color: rgba(255,0,0,1.0);
border-radius: 5px;}
.textbox { border-radius:5px; background-color:rgba(0,0,0,0.95); height:25px; color: white;
font-family: Bookman Old Style; margin-top:15px; margin-left: 5px;
font-size: 16px; width: 200px; border-color:rgba(0,0,0,0.85); transition: .3s;}
.request:hover { background-color: rgba(0,0,0,0.9); transition: 0.5s; }
.btn:hover { background-color: rgba(255,0,0,1.0); transition: .3s ease;}
.btn { border-radius:5px; width:200px; margin-top:15px; margin-left:50px; padding:8px;
font-weight:none;
border-width:2px; color: white; cursor: pointer; font-size: 15px; font-family: Verdana;
border-color: rgba(255,0,0,1.0); text-decoration: none;background-color: rgba(0,0,0,0.6); transition: .5s; }
</style>
<link rel='stylesheet' type='text/css' href='./css/homestyle.css' >
</head>
<body>
<header>
<nav>
<h1>FRIENDZY</h1>
<ul id="list">
<li> <a class="colblack" href="./webhome.php">Home</a> </li>
<li> <a class="colblack" href="./Student_Login.php">Student Corner</a> </li>
<li> <a class="colblack" href="./Faculty_Login.php">Faculty Corner</a> </li>
<li> <a class="colblack" href="./HOD_Login.php">HOD Corner</a> </li>
<li> <a class="colred" href="#">Admin Corner</a> </li>
</ul>
</nav>
</header>
<div class="divider"></div>
<div class="backimg">
<div class="workarea">
<div class="panel">
<form action="" method="post">
<table style='color:white; font-size:18px; font-family:Bookman Old Style;'>
<tr>
<td>
<input class="btn" type="submit" value="Logout" name="btn_logout">
</td>
<td style='font-size:20px; padding-left:50px; margin-top:10px;'>
<center><p>Change Password</p></center>
</td>
<td style='padding-left:20px;'>
<input class="btn" type="submit" value="Home" name="btn_home">
</td>
</tr>
</table>
</form>
</div>
<div class="change">
<form action="" method="post">
<table style='color:white; font-size:18px; font-family:Bookman Old Style; padding-top:50px;'>
<tr >
<td style="padding-top:20px; padding-left:150px;">
Current Password
</td>
<td style="padding-left:20px;">
<input class="textbox" type="password" name="txt_cur_uid">
</td>
</tr>
<tr >
<td style="padding-top:20px; padding-left:150px;">
New Password
</td>
<td style="padding-left:20px;">
<input class="textbox" type="password" name="txt_new_uid">
</td>
</tr>
<tr >
<td style="padding-top:20px; padding-left:150px;">
Confirm Password
</td>
<td style="padding-left:20px;">
<input class="textbox" type="password" name="txt_c_new_uid">
</td>
</tr>
<tr >
<td style="padding-left:40px;">
<input class="btn" type="submit" value="Change" name="btn_change">
</td>
<td style="padding-left:20px;">
<input class="btn" type="reset" value="Clear" name="btn_clear">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div class="divider"></div>
<footer></footer>
</body>
</html>
<?php
if(isset($_POST['btn_home']))
echo '<script type="text/javascript"> location.href="./Admin_Home.php"</script>';
if(isset($_POST['btn_logout']))
echo '<script type="text/javascript"> location.href="./Admin_Logout.php"</script>';
?>
<?php
if(isset($_POST['btn_change']))
{
$id=test_input($_POST['txt_cur_uid']);
$new_id=test_input($_POST['txt_new_uid']);
$c_new_id=test_input($_POST['txt_c_new_uid']);
if($id=="" || $c_new_id==""|| $c_new_id=="")
{
echo '<script type="text/javascript"> alert("Please enter all the fields.") </script>';
mysqli_close($con);
echo '<script type="text/javascript"> location.href="./Admin_Change_Password.php"</script>';
}
else
{
$query="select * from admin_security where password='$id'";
$result=mysqli_query($con,$query);
if($result)
{
$row_count=mysqli_num_rows($result);
if($row_count!=1)
{
echo '<script type="text/javascript"> alert("Current Password is wrong.") </script>';
mysqli_close($con);
echo '<script type="text/javascript"> location.href="./Admin_Change_Password.php"</script>';
}
}
if(!($new_id==$c_new_id))
{
echo '<script type="text/javascript"> alert("New Passwords does not match.") </script>';
mysqli_close($con);
echo '<script type="text/javascript"> location.href="./Admin_Change_Password.php"</script>';
}
$query="update admin_security set password='$new_id' where password='$id'";
$result=mysqli_query($con,$query);
if($result)
echo '<script type="text/javascript"> alert("Password Changed Sucessfully. Please Login with your new password.") </script>';
mysqli_close($con);
echo '<script type="text/javascript"> location.href="./Admin_Login.php"</script>';
}
}
?>