-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangepassword.php
More file actions
214 lines (178 loc) · 8.89 KB
/
changepassword.php
File metadata and controls
214 lines (178 loc) · 8.89 KB
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
<?php
session_start();
include "connection.php";
$res19=mysqli_query($link,"select username from student_register where username='$_SESSION[username]'");
$count19=mysqli_num_rows($res19);
if(!isset($_SESSION["username"]) || ($count19==0)){
?>
<script type="text/javascript">
window.location="student_login.php";
</script>
<?php
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Student Beneficiary System | SBS </title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/nprogress.css" rel="stylesheet">
<link href="css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="#" class="site_title"><i class="fa fa-book"></i> <span>SBS</span></a>
</div>
<div class="clearfix"></div>
<!-- menu profile quick info -->
<div class="profile clearfix">
<div class="profile_info">
<span>Welcome,</span>
<h2><?php echo $_SESSION["username"];?></h2>
</div>
<div class="clearfix"></div>
</div>
<!-- /menu profile quick info -->
<br/>
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a href="shome.php"><i class="fa fa-home"></i> Home <span class="fa fa-chevron"></span></a>
</li>
<li><a href="sabout_us.php"><i class="fa fa-info-circle"></i> About Us <span class="fa fa-chevron"></span></a>
</li>
<li><a href="scontact.php"><i class="fa fa-mobile-phone"></i> Contact <span class="fa fa-chevron"></span></a>
</li>
<li><a href="sold_books.php"><i class="fa fa-list-alt"></i> Sold books <span class="fa fa-chevron"></span></a>
</li>
<li><a href="wishlist_books.php"><i class="fa fa-heart"></i> Wishlist <span class="fa fa-chevron"></span></a>
</li>
<li><a href="options.php"><i class="fa fa-shopping-cart"></i> Options page <span class="fa fa-chevron"></span></a>
</li>
<li><a href="bought_books.php"><i class="fa fa-gavel"></i> Bought books <span class="fa fa-chevron"></span></a>
</li>
<li><a href="sold_book_status.php"><i class="fa fa-check"></i> Sold book status <span class="fa fa-chevron"></span></a>
</li>
<li><a href="add_books.php"><i class="fa fa-money"></i> Sell book <span class="fa fa-chevron"></span></a>
</li>
<li><a href="pretranreport.php"><i class="fa fa-history"></i> Previous Transaction reports <span class="fa fa-chevron"></span></a>
</li>
<li><a href="notifications.php"><i class="fa fa-bell"></i> Notifications <span class="fa fa-chevron"></span></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav>
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown"
aria-expanded="false">
<?php $res2=mysqli_query($link,"select fname,lname from student where username='$_SESSION[username]'"); $row2=mysqli_fetch_array($res2); echo $row2["fname"]." ".$row2["lname"];?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="logout.php"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<!-- /top navigation -->
<!-- page content area main -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3></h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row" style="min-height:500px">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Change Password</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<form name="form1" action="" method="post" class="col-lg-6" enctype="multipart/form-data">
<table class="table table-bordered">
<tr>
<td>
<input type="password"class="form-control" placeholder="Enter current password" name="cpwd" required=""></td>
</tr>
<tr>
<td><input type="password"class="form-control" placeholder="Enter new password" name="npwd" required=""></td>
</tr>
<tr>
<td><input type="password"class="form-control" placeholder="Retype new password" name="rnpwd" required=""></td>
</tr>
<tr>
<td><input type="submit" name="submit1" class="btn btn-default submit" value="Change password" style="background-color: blue; color:white"></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<?php
if(isset($_POST["submit1"]))
{
$res7=mysqli_query($link,"select * from student_register where username='$_SESSION[username]'");
$row7=mysqli_fetch_array($res7);
if($_POST['cpwd']!=$row7['password']){
?>
<div class="alert alert-danger col-lg-6 col-lg-push-3">
<strong style="color:white">Invalid</strong> current password!
<div class="clearfix"></div>
</div>
<?php
}
elseif($_POST['npwd']!=$_POST['rnpwd']){
?>
<script type="text/javascript">
alert("Password and confirm password is not matching!Rechange");
window.location="changepassword.php";
</script>
<?php
}
else{
mysqli_query($link,"update student_register set password='$_POST[npwd]' where username = '$_SESSION[username]'");
mysqli_query($link,"update student_register set confirmpasswd='$_POST[npwd]' where username = '$_SESSION[username]'");
?>
<script type="text/javascript">
alert("Password changed successfully");
window.location="notifications.php";
</script>
<?php
}
}
?>
<?php
include "footer.php";
?>