forked from g33kyrash/Online-Banking-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_password.php
64 lines (58 loc) · 2.3 KB
/
change_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
<?php
session_start();
include '_inc/dbconn.php';
if(!isset($_SESSION['admin_login']))
header('location:adminlogin.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Change Password</title>
<link rel="stylesheet" href="newcss.css">
</head>
<?php include 'header.php' ?>
<div class='content'>
<?php include 'admin_navbar.php'?>
<div class='admin_change_pwd'>
<form action="" method="POST">
<table align="center">
<tr>
<td>Enter old password</td>
<td><input type="password" name="old_password" required=""/></td>
</tr>
<tr>
<td>Enter new password</td>
<td><input type="password" name="new_password" required=""/></td>
</tr>
<tr>
<td>Enter password again</td>
<td><input type="password" name="again_password" required=""/></td>
</tr>
<tr>
<td colspan="2" align='center' style='padding-top:20px'><input type="submit" name="change_password" value="Change Password" class="addstaff_button"/></td>
</tr>
</table>
</form>
</div>
</div>
<?php
if(isset($_REQUEST['change_password'])){
$sql="SELECT * FROM admin WHERE id='1'";
$result=mysql_query($sql);
$rws= mysql_fetch_array($result);
$old= mysql_real_escape_string($_REQUEST['old_password']);
$new= mysql_real_escape_string($_REQUEST['new_password']);
$again= mysql_real_escape_string($_REQUEST['again_password']);
if($rws[9]==$old && $new==$again){
$sql1="UPDATE admin SET pwd='$new' WHERE id='1'";
mysql_query($sql1) or die(mysql_error());
header('location:admin_hompage.php');
}
else{
header('location:change_password.php');
}
}
?>
</div>
<?php include 'footer.php';?>