-
Notifications
You must be signed in to change notification settings - Fork 0
/
newpas.php
154 lines (126 loc) · 3.4 KB
/
newpas.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php include("h&f/header.php"); ?>
<?php
include("dbconnect.php");
$b = $_GET['ID'];
$bc = $_GET['VID'];
$sql = "select * from user where id = '$b' ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$user_data = mysqli_fetch_assoc($result);
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$password = $_POST['password'];
$con_password = $_POST['con_password'];
$verification = $_POST['verification'];
$verify = password_verify($verification, $bc);
// if password match
if ($verify) {
if ($con_password === $password) {
if (!empty($password)) {
$hash = password_hash($password, PASSWORD_DEFAULT);
$query = "UPDATE user SET Password='$hash' WHERE id ='$b'";
$result = mysqli_query($conn, $query);
if (!$result) {
echo "Please Try Again";
} else {
header("Location:login.php");
die;
}
} else {
echo "Please enter some valid information!";
}
} else {
echo "Password did not Match";
}
} else {
echo "Verification Code did not Match";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
html,
body {
height: 100%;
}
body {
background-image: url("picture/car3.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
#box {
background-color: #c4c3bb;
margin: auto;
width: 500px;
height: 500px;
padding: 50px;
color: black;
font-size: 20px;
}
input[type=submit] {
color: white;
background-color: green;
border: none;
padding-top: 10px;
margin-left: 180px;
padding: 4px 10px;
font-size: 20px;
}
/* unvisited link */
a:link {
color: blue;
}
/* visited link */
a:visited {
color: green;
}
/* mouse over link */
a:hover {
color: hotpink;
}
/* selected link */
a:active {
color: red;
}
</style>
</head>
<body>
<div id="box">
<span>
<h4><?php echo $user_data['Username']; ?> Enter New Password</h4>
</span>
<form method="post" action="">
<table cellpadding="2">
<div class="form-group">
<tr>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-right:15px;font-size:20px"><label for="name">Verification Code:</label></td>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-left:30px">
<input class="form-control" style="height:25px;width:250px" type="text" name="verification">
</td>
</tr>
</div>
<div class="form-group">
<tr>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-right:15px;font-size:20px"><label for="name">New Password:</label></td>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-left:30px">
<input class="form-control" style="height:25px;width:250px" type="password" name="password">
</td>
</tr>
</div>
<div class="form-group">
<tr>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-right:15px;font-size:20px"><label for="name">Confirm Password:</label></td>
<td style=" padding-top: 15px;padding-bottom: 15px;padding-left:30px">
<input class="form-control" style="height:25px;width:250px" type="password" name="con_password">
</td>
</tr>
</div>
</table><br>
<input class="btn btn-success" type="submit" value="Submit">
</form>
</div>
</body>
</html>
<?php include("h&f/footer.php"); ?>