-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange-password.php
119 lines (107 loc) · 4.12 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
<?php
session_start();
include('includes/dbconnection.php');
error_reporting(0);
if (strlen($_SESSION['ttmsaid']==0)) {
header('location:logout.php');
} else{
if(isset($_POST['submit']))
{
$adminid=$_SESSION['ttmsaid'];
$cpassword=$_POST['currentpassword'];
$newpassword=$_POST['newpassword'];
$query=mysqli_query($con,"select ID from tbladmin where ID='$adminid' and Password='$cpassword'");
$row=mysqli_fetch_array($query);
if($row>0){
$ret=mysqli_query($con,"update tbladmin set Password='$newpassword' where ID='$adminid'");
$msg= "Your password successully changed";
} else {
$msg="Your current password is wrong";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Toll Tax Management System || Change Password</title>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); }) </script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/font-awesome.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!----webfonts--->
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
<!---//webfonts--->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></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>
</head>
<body>
<div id="wrapper">
<!-- Navigation -->
<?php include_once('includes/sidebar.php');?>
<?php include_once('includes/header.php');?>
<div id="page-wrapper">
<div class="col-md-12 graphs">
<div class="xs">
<h3>Change Password</h3>
<div class="well1 white">
<form class="form-floating ng-pristine ng-invalid ng-invalid-required ng-valid-email ng-valid-url ng-valid-pattern" method="post" name="changepassword" onsubmit="return checkpass();" action="">
<p style="font-size:16px; color:red" align-item="center"> <?php if($msg){
echo $msg;
} ?> </p>
<fieldset>
<?php
$adminid=$_SESSION['ttmsaid'];
$ret=mysqli_query($con,"select * from tbladmin where ID='$adminid'");
$cnt=1;
while ($row=mysqli_fetch_array($ret)) {
?>
<div class="form-group">
<label class="control-label">Current Password</label>
<input type="password" class="form-control1 ng-invalid ng-invalid-required ng-touched" required="true" id="currentpassword" name="currentpassword" value="">
</div>
<div class="form-group">
<label class="control-label">New Password</label>
<input type="password" class="form-control1 ng-invalid ng-invalid-required ng-touched" required="true" id="newpassword" name="newpassword" value="">
</div>
<div class="form-group">
<label class="control-label">Confirm Password</label>
<input type="password" class="form-control1 ng-invalid ng-invalid-required ng-touched" required="true" id="confirmpassword" name="confirmpassword" value="">
</div>
<?php } ?>
<div class="form-group">
<p style="text-align: center;"> <button type="submit" name="submit" class="btn btn-primary">Change</button></p>
</div>
</fieldset>
</form>
</div>
</div>
<?php include_once('includes/footer.php');?>
</div>
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- Nav CSS -->
<link href="css/custom.css" rel="stylesheet">
<!-- Metis Menu Plugin JavaScript -->
<script src="js/metisMenu.min.js"></script>
<script src="js/custom.js"></script>
</body>
</html>
<?php } ?>