-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadminchangepassword.php
112 lines (103 loc) · 2.9 KB
/
adminchangepassword.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
<?php
include("adheader.php");
include("dbconnection.php");
session_start();
if(isset($_POST[submit]))
{
$sql = "UPDATE admin SET password='$_POST[newpassword]' WHERE password='$_POST[oldpassword]' AND adminid='$_SESSION[adminid]'";
$qsql= mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<div class='alert alert-success'>
Password updated successfully
</div>";
}
else
{
echo "<div class='alert alert-warning'>
admin record update Failed
</div>";
}
}
?>
<div class="container-fluid">
<div class="block-header">
<h2 class="text-center"> Admin's Password</h2>
</div>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<form method="post" action="" name="frmadminprofile" onSubmit="return validateform()">
<div class="body">
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group">
<div class="form-line">
<input class="form-control" type="password" name="oldpassword" id="oldpassword" placeholder="Old Password" />
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group">
<div class="form-line">
<input class="form-control" type="password" name="newpassword" id="newpassword" placeholder="New Password" />
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group">
<div class="form-line">
<input class="form-control" type="password" name="password" id="password" placeholder="Confirm Password" />
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<input type="submit" class="btn btn-raised g-bg-cyan" name="submit" id="submit" value="Submit" />
</div>
</div>
</div>
</form>
<div class="clear"></div>
</div>
</div>
<?php
include("adfooter.php");
?>
<script type="application/javascript">
function validateform1()
{
if(document.frmadminchange.oldpassword.value == "")
{
alert("Old password should not be empty..");
document.frmadminchange.oldpassword.focus();
return false;
}
else if(document.frmadminchange.newpassword.value == "")
{
alert("New Password should not be empty..");
document.frmadminchange.newpassword.focus();
return false;
}
else if(document.frmadminchange.newpassword.value.length < 8)
{
alert("New Password length should be more than 8 characters...");
document.frmadminchange.newpassword.focus();
return false;
}
else if(document.frmadminchange.newpassword.value != document.frmadminchange.password.value )
{
alert(" New Password and confirm password should be equal..");
document.frmadminchange.password.focus();
return false;
}
else
{
return true;
}
}
</script>