forked from Kowshikreddy007/Botswithdots-SeatingAllotment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changepass.php
76 lines (75 loc) · 3.09 KB
/
changepass.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
<!--change passowrd-->
<!doctype html>
<html>
<head>
<title>Change Password</title>
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/bootstrap.css"/>
<link rel="stylesheet" href="css/changepass.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<?php
$server='localhost';
$dbuser='root';
$dbpass='';
$db='trial';
$conn=mysqli_connect($server,$dbuser,$dbpass,$db);
if(isset($_POST['changepassword']))
{
$currentpassword=$_POST['currentpassword']; #current password
$newpassword=$_POST['newpassword'];#new password is taken here
$confirmpassword=$_POST['confirmpassword'];#password is confirm here it is use for match with new password enter befor confirm password
# echo "$currentpassword";
# echo "$newpassword";
# echo "$confirmpassword";
$querya="SELECT * from admintable where adminname='alkesha' ";
$chg_pwd=mysqli_query($conn,$querya);
$chg_pwd1=mysqli_fetch_array($chg_pwd);
$data_pwd=$chg_pwd1['password'];
if($data_pwd == $currentpassword){
if($newpassword == $confirmpassword){
$queryb="UPDATE admintable set password='$newpassword' where adminname='alkesha'";
$update_pwd=mysqli_query($conn,$queryb);
echo "<script>alert('Update successfully'); window.location='adminlogin.php'</script>";
}
else {
echo "<script>alert('your new and confirm password are not match'); window.location='changepass.php'</script>";
}
}
else{
echo "<script>alert('your currentpassword is wrong'); window.location='changepass.php'</script>";
}
}
?>
<a href="adminbranchyear.php" class="btn back-button btn-sm"><span class="glyphicon glyphicon-chevron-left"></span>back</a>
<div class="container vertical-align">
<div class="row">
<div class="col-xs-4 col-xs-push-4" style="background-color: #ffffff;">
<div class="panel panel-default">
<div class="panel-body">
<form class="form-horizontal content" action="<?php echo $_SERVER['PHP_SELF']?>" method="post" role="form">
<div class="form-group">
<label>Current Password :</label>
<input type="password" class="form-control " name="currentpassword" id="password" autocomplete="off"placeholder="current password"></input>
<br>
<label>New Password :</label>
<input type="password" class="form-control " name="newpassword" id="password" autocomplete="off" placeholder="new password"></input>
<br>
<label>Confirm Password :</label>
<input type="password" class="form-control " name="confirmpassword" id="password" autocomplete="off" placeholder="confirm password"></input>
</div>
<div class="form-group">
<center><button type="submit" name="changepassword" class="btn passcg btn-default">change password</button>  
<a href="datainsert.php" type="button" class="btn passcg btn-default">Back</a></center>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>