forked from suman-kr/visitor-management-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_pass.php
122 lines (98 loc) · 2.79 KB
/
new_pass.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
session_start();
include 'config.php';
if(isset($_SESSION['userid'])== true)
{
$id=$_SESSION['userid'];
if(isset($_POST['pass']))
{
$old_pass = $_POST['old'];
$new_pass = $_POST['new'];
$renew_pass = $_POST['renew'];
$query = "SELECT PASSWORD FROM SECURITY WHERE SID_NO= '$id'";
$result1=mysqli_query($db,$query);
$row = mysqli_fetch_array($result1,MYSQLI_ASSOC);
$password = $row["PASSWORD"];
if($old_pass == $password)
{
if($new_pass == $renew_pass)
{
$sql="UPDATE SECURITY SET PASSWORD = '$new_pass' WHERE SID_NO = '$id' ";
$result=mysqli_query($db,$sql);
if($result1)
{
echo "<h1> Your Password has been changed</h1>";
echo '<a href="http://localhost/project/profile.php">My Profile</a>';
}
}
else{
echo "<h3> The New password and retyped password is incorrect";
}
}else{
echo "<h3> The password typed is incorrect, Try Again!";
}
}
}
?>
<!DOCTYPE html>
<style>
input[type=text], input[type=password], input[type=number], input[type=tel]{
width: 30%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
border-radius: 10px;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
font-size:20px;
font-family: Impact;
margin: 4px 20px;
border: none;
cursor: pointer;
border-radius: 10px;
width: 20%;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 7);
}
body{
background-image: url("back.jpg");
}
.box{
position: relative;
top: 200px;
}
.changepass{
position: relative;
font-family: Impact;
font-size: 28px;
top: 180px;
left: 650px;
}
</style>
<html>
<head>
<title>Change Password</title>
</head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<body>
<div class="changepass">
<strong>Change password</strong>
</div>
<div class="box">
<form action = "<?php echo $_SERVER['PHP_SELF'];?>" method = "post">
<center><input type = "password" placeholder="Old Password" name= "old" required=""></input> </center>
<center><input type = "password" placeholder="New Password" name= "new" required=""></input> </center>
<center><input type = "password" placeholder="ReType New Password" name= "renew" required=""></input> </center>
<center><button input type= "submit" value="Update" name= "pass" style="border-radius: 10px;">Save Changes</button></center>
</form>
</div>
<ul class="nav nav-pills" style="position: fixed;top: 600px;left: 45%;">
<li class="nav-item">
<a class="nav-link active" href="profile.php">Back to Profile Page</a> </li>
</ul>
</body>
</html>