-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathchange_password.php
More file actions
89 lines (74 loc) · 2.08 KB
/
Copy pathchange_password.php
File metadata and controls
89 lines (74 loc) · 2.08 KB
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
<?php
/**
* Change Password
* php version 8.1
*
* @category Management
*
* @package None
*
* @author Waqas Ahmad <waqaskanju@gmail.com>
*
* @license http://www.waqaskanju.com/license MIT
*
* @link http://www.waqaskanju.com
**/
session_start();
require_once 'sand_box.php';
$link=$LINK;
if (isset($_SESSION['user'])) {
if (isset($_POST['submit'])) {
$old_password=$_POST['old_password'];
$old_password=Validate_input($old_password);
$old_password=md5($old_password);
$new_password=$_POST['new_password'];
$new_password= Validate_input($new_password);
$new_password= md5($new_password);
$employee_id=$_SESSION['user'];
$employee_id=Validate_input($employee_id);
$q="SELECT Password FROM login WHERE Employee_id='$employee_id'";
$exe=mysqli_query($link, $q);
$exer=mysqli_fetch_assoc($exe);
$db_password=$exer['Password'];
if ($old_password===$db_password) {
$q2="Update Login SET Password='$new_password' WHERE
Employee_Id='$employee_id'";
$exe2=mysqli_query($link, $q2);
if ($exe2) {
echo "Password changed Successfully";
}
} else {
echo "Invalid Old Password";
}
}
} else {
header('refresh:1 ; url=login.php');
}
Page_header('Change Password');
?>
</head>
<body>
<?php require_once 'nav.html'; ?>
<div class="container">
<p>Page for changing password</p>
<form action="#" method="POST">
<div>
<label for="name">Old Password*</label>
<input type="password" id="old_password" name="old_password"
class="form-control"
placeholder="Type Old Password" required>
<div>
<div>
<label for="name">New Password*</label>
<input type="password" id="new_password" name="new_password"
class="form-control"
placeholder="Type Password" required>
<div>
<input type="submit" name="submit" value="Change Password"
class="btn btn-primary mt-3">
</div>
</form>
</div>
<?php
Page_close();
?>