-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchange-password.php
183 lines (155 loc) · 5.23 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
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if (strlen($_SESSION['bbdmsdid']==0)) {
header('location:logout.php');
} else{
if(isset($_POST['change']))
{
$uid=$_SESSION['bbdmsdid'];
$cpassword=md5($_POST['currentpassword']);
$newpassword=md5($_POST['newpassword']);
$sql ="SELECT ID FROM tblblooddonars WHERE id=:uid and Password=:cpassword";
$query= $dbh -> prepare($sql);
$query-> bindParam(':uid', $uid, PDO::PARAM_STR);
$query-> bindParam(':cpassword', $cpassword, PDO::PARAM_STR);
$query-> execute();
$results = $query -> fetchAll(PDO::FETCH_OBJ);
if($query -> rowCount() > 0)
{
$con="update tblblooddonars set Password=:newpassword where id=:uid";
$chngpwd1 = $dbh->prepare($con);
$chngpwd1-> bindParam(':uid', $uid, PDO::PARAM_STR);
$chngpwd1-> bindParam(':newpassword', $newpassword, PDO::PARAM_STR);
$chngpwd1->execute();
echo '<script>alert("Your password successully changed")</script>';
} else {
echo '<script>alert("Your current password is wrong")</script>';
}
}
?>
<!DOCTYPE html>
<html lang="zxx">
<head>
<title>Blood Bank Donar Management System !! Change Password</title>
<script>
addEventListener("load", function () {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
}
</script>
<script type="text/javascript">
function checkpass()
{
if(document.changepassword.newpassword.value!=document.changepassword.confirmpassword.value)
{
alert('New Password and Confirm Password field does not match');
document.changepassword.confirmpassword.focus();
return false;
}
return true;
}
</script>
<!-- Custom-Files -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- Bootstrap-Core-CSS -->
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<!-- Style-CSS -->
<link rel="stylesheet" href="css/fontawesome-all.css">
<!-- Font-Awesome-Icons-CSS -->
<!-- //Custom-Files -->
<!-- Web-Fonts -->
<link href="//fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese"
rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese"
rel="stylesheet">
<!-- //Web-Fonts -->
</head>
<body>
<?php include('includes/header.php');?>
<!-- banner 2 -->
<div class="inner-banner-w3ls">
<div class="container">
</div>
<!-- //banner 2 -->
</div>
<!-- page details -->
<div class="breadcrumb-agile">
<div aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.php">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Change Password</li>
</ol>
</div>
</div>
<!-- //page details -->
<!-- contact -->
<div class="appointment py-5">
<div class="py-xl-5 py-lg-3">
<div class="w3ls-titles text-center mb-5">
<h3 class="title">Change Password</h3>
<span>
<i class="fas fa-user-md"></i>
</span>
</div>
<div class="d-flex">
<div class="appoint-img">
</div>
<div class="contact-right-w3l appoint-form">
<h5 class="title-w3 text-center mb-5">Reset your password if needed</h5>
<form action="#" method="post" onsubmit="return checkpass();" name="changepassword">
<div class="form-group">
<label for="recipient-name" class="col-form-label">Current Password</label>
<input type="password" class="form-control" name="currentpassword" id="currentpassword"required='true'>
</div>
<div class="form-group">
<label for="recipient-phone" class="col-form-label">New Password</label>
<input type="password" name="newpassword" class="form-control" required="true">
</div>
<div class="form-group">
<label for="recipient-phone" class="col-form-label">Confirm Password</label>
<input type="password" class="form-control" name="confirmpassword" id="confirmpassword" required='true'>
</div>
<input type="submit" value="Update" name="change" class="btn_apt">
</form>
</div>
<div class="clerafix"></div>
</div>
</div>
</div>
<!-- //contact -->
<?php include('includes/footer.php');?>
<!-- Js files -->
<!-- JavaScript -->
<script src="js/jquery-2.2.3.min.js"></script>
<!-- Default-JavaScript-File -->
<!--start-date-piker-->
<link rel="stylesheet" href="css/jquery-ui.css" />
<script src="js/jquery-ui.js"></script>
<script>
$(function () {
$("#datepicker,#datepicker1").datepicker();
});
</script>
<!-- //End-date-piker -->
<!-- fixed navigation -->
<script src="js/fixed-nav.js"></script>
<!-- //fixed navigation -->
<!-- smooth scrolling -->
<script src="js/SmoothScroll.min.js"></script>
<!-- move-top -->
<script src="js/move-top.js"></script>
<!-- easing -->
<script src="js/easing.js"></script>
<!-- necessary snippets for few javascript files -->
<script src="js/medic.js"></script>
<script src="js/bootstrap.js"></script>
<!-- Necessary-JavaScript-File-For-Bootstrap -->
<!-- //Js files -->
</body>
</html><?php } ?>