-
Notifications
You must be signed in to change notification settings - Fork 0
/
patientchangepassword.php
103 lines (95 loc) · 3.08 KB
/
patientchangepassword.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
<?php
include("adheader.php");
include("dbconnection.php");
if(isset($_POST['submit']))
{
$sql = "UPDATE patient SET password='$_POST[newpassword]' WHERE password='$_POST[oldpassword]' AND patientid='$_SESSION[patientid]'";
$qsql= mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<div class='alert alert-success'>
Password has been updated successfully
</div>
<script>alert('..');</script>";
}
else
{
echo "<div class='alert alert-danger'>
Update Failed
</div>
";
}
}
?>
<div class="container-fluid">
<div class="block-header">
<h2 class="text-center"> Patient'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="frmpatchange" onSubmit="return validateform()"
style="padding: 10px">
<div class="form-group">
<label>Old Password</label>
<div class="form-line">
<input class="form-control" type="password" name="oldpassword" id="oldpassword" />
</div>
</div>
<div class="form-group">
<label>New Password</label>
<div class="form-line">
<input class="form-control" type="password" name="newpassword" id="newpassword" />
</div>
</div>
<div class="form-group">
<label>Confirm Password</label>
<div class="form-line">
<input class="form-control" type="password" name="password" id="password" />
</div>
</div>
<input class="btn btn-raised g-bg-cyan" type="submit" name="submit" id="submit" value="Submit" />
</form>
<p> </p>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<?php
include("adfooter.php");
?>
<script type="application/javascript">
function validateform()
{
if(document.frmpatchange.oldpassword.value == "")
{
alert("Old password should not be empty..");
document.frmpatchange.oldpassword.focus();
return false;
}
else if(document.frmpatchange.newpassword.value == "")
{
alert("New Password should not be empty..");
document.frmpatchange.newpassword.focus();
return false;
}
else if(document.frmpatchange.newpassword.value.length < 6)
{
alert("New Password length should be more than 6 characters...");
document.frmpatchange.newpassword.focus();
return false;
}
else if(document.frmpatchange.newpassword.value != document.frmpatchange.password.value )
{
alert(" New Password and confirm password should be equal..");
document.frmpatchange.password.focus();
return false;
}
else
{
return true;
}
}
</script>