-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpassword.php
65 lines (63 loc) · 2.9 KB
/
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
<?php include("header.inc.php"); ?>
</div>
<section class="panel panel-default" style="border:none;">
<div class="row">
<div class="col-md-12" style="margin-bottom:20px;">
<div class="row">
<h3 style="text-align:left; margin-left:20px;">
<i class="fa fa-cog"></i> Change Password
</h3>
<div class="col-md-8 col-sm-12 col-xs-12">
<?php
if(isset($_POST['pass']))
{
$user = $_SESSION['matric'];
$query44 = "SELECT * FROM user WHERE matric = '$user'";
$result44 = mysql_query($query44)
or die ("Couldn't execute query44.");
while ($row44 = mysql_fetch_array($result44,MYSQL_ASSOC))
{
$old = $row44['password'];
$current = trim(md5(sha1($_POST['current'])));
$new = trim(md5(sha1($_POST['password'])));
if ($old == $current) {
$query30 = "UPDATE user SET password = '$new' WHERE matric = '$user'";
$result30 = mysql_query($query30) or die ("Couldn't execute query30");
echo "<div class ='alert alert-success'>Password Changed.</div>";
}else{
echo "<div class ='alert alert-danger'>Password Typed Does Not Match Your Current Password.</div>";
}
}
}
?>
</div>
<form action="password.php" method="POST" class="form-horizontal form-label-left input_mask">
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
Current Password
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="password" class="form-control has-feedback-left" name="current" id="inputSuccess2" placeholder="Current Password" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<div class="col-md-2 col-sm-12 col-xs-12">
New Password
</div>
<div class="col-md-6 col-sm-12 col-xs-12">
<input type="password" class="form-control has-feedback-left" name="password" id="inputSuccess2" placeholder="New Password" required>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="col-md-6 col-sm-6 col-xs-12">
<a href="index.php" class="btn btn-default"><i class="fa fa-home"></i> Home</a>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<button type="submit" name="pass" class="btn btn-info"> <i class="fa fa-cog"></i> Change Password</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php include("footer.inc.php"); ?>