-
Notifications
You must be signed in to change notification settings - Fork 0
/
empchangepwd.php
153 lines (132 loc) · 4.45 KB
/
empchangepwd.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
<?php
include("header.php");
//statement starts here
if(isset($_POST['submit']))
{
$sql="UPDATE employee SET password='$_POST[newpassword]' WHERE password='$_POST[oldpassword]' AND empid='$_SESSION[empid]' ";
$qsql = mysqli_query($con,$sql);
echo mysqli_error($con);
if(mysqli_affected_rows($con) == 1)
{
echo "<script>alert('Password updated successfully..');</script>";
echo "<script>window.location='empchangepwd.php';</script>";
}
else
{
echo "<script>alert('Failed to change password');</script>";
echo "<script>window.location='empchangepwd.php';</script>";
}
}
//statement ends here
?>
<div class="slider">
<div class="callbacks_container">
<ul class="rslides" id="slider4">
<li style="background-color:black;height:150px;">
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
<section class="about" id="about">
<div class="container py-lg-5 py-md-5 py-sm-4 py-3">
<div id="horizontalTab">
<ul class="resp-tabs-list justify-content-center">
<li data-blast="bgColor">ADMIN Change Password </li>
</ul>
<div class="resp-tabs-container">
<div class="tab1">
<div class="row mt-lg-4 mt-3">
<div class="col-md-5 about-txt-img">
<img src="images/login.jpg" class="img-thumbnail" width="100%">
</div>
<div class="col-md-7 latest-list">
<div class="about-jewel-agile-left">
<h5 class="mb-3" data-blast="color"> </h5>
<p>
<form action="" method="post" onsubmit="return validateform()">
<div class="form-group">
<label for="email">Old Password:<span class="classvalidate" id="idoldpassword"></span></label>
<input type="password" class="form-control" id="oldpassword" placeholder="Enter Old Password" name="oldpassword" value="<?php echo $rsedit['oldpassword']; ?>">
</div>
<div class="form-group">
<label for="email">New Password:<span class="classvalidate" id="idnewpassword"></span></label>
<input type="password" class="form-control" id="newpassword" placeholder="Enter New Password" name="newpassword" value="<?php echo $rsedit['newpassword']; ?>">
</div>
<div class="form-group">
<label for="email">Confirm Password:<span class="classvalidate" id="idconfirmpassword"></span></label>
<input type="password" class="form-control" id="confirmpassword" placeholder="Enter Confirm Password" name="confirmpassword" value="<?php echo $rsedit['confirmpassword']; ?>">
</div>
<button type="submit" name="submit" class="btn btn-info">Change Password</button>
</form>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
include("footer.php");
?>
<script>
$(document).ready( function () {
$('#myTable').DataTable();
} );
</script>
<script>
function confirmdel()
{
if(confirm("Are you sure want to delete this record?") == true)
{
return true;
}
else
{
return false;
}
}
</script>
<script>
function validateform()
{
var numericExpression = /^[0-9]+$/;
var alphaExp = /^[a-zA-Z]+$/;
var alphaspaceExp = /^[a-zA-Z\s]+$/;
var alphaNumericExp = /^[0-9a-zA-Z]+$/;
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
var validateform="true";
$( ".classvalidate" ).empty();
if(document.getElementById("oldpassword").value=="")
{
document.getElementById("idoldpassword").innerHTML="Oldpassword Should not be empty...";
validateform="false";
}
if(document.getElementById("newpassword").value != document.getElementById("confirmpassword").value)
{
document.getElementById("idnewpassword").innerHTML="New Password and Confirm password not matching...";
validateform="false";
}
if(document.getElementById("newpassword").value=="")
{
document.getElementById("idnewpassword").innerHTML="New password Should not be empty...";
validateform="false";
}
if(document.getElementById("confirmpassword").value=="")
{
document.getElementById("idconfirmpassword").innerHTML="Confirm password Should not be empty...";
validateform="false";
}
if(validateform=="true")
{
return true;
}
else
{
return false;
}
}
</script>