-
Notifications
You must be signed in to change notification settings - Fork 1
/
new-password.php
99 lines (70 loc) · 2.17 KB
/
new-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
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
<?php
include 'config.php';
// error_reporting(0);
session_start();
if (isset($_SESSION['username'])) {
header("Location: login.php");
}
if (isset($_POST['submit'])) {
if(isset($_GET['token'])){
$token = $_GET['token'];
$newpassword = md5($_POST['password']);
$cpassword = md5($_POST['cpassword']);
if ($newpassword == $cpassword) {
$updatequery = "update users set password = '$newpassword' where token = '$token'";
$result = mysqli_query($conn, $updatequery );
if ($result) {
$_SESSION['msg']="Your Password has been Updated!";
header('location:login.php');
}
else{
$_SESSION['pwd-reset']="Your Password is not Updated!";
header('location: new-password.php');
}
}else{
$_SESSION['pwd-reset']="Password are not matching";
header('location: new-password.php');
}
}else{
$_SESSION['pwd-reset']="No token found";
header('location: new-password.php');
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" sizes="144x144" href="images/favicon.png">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<title>Reset Password</title>
</head>
<body>
<div class="container">
<form action="" method="POST" class="login-email">
<p class="login-text" style="font-size: 2rem; font-weight: 800;">Change Password</p>
<p class="pass-msg">
<?php
if(isset($_SESSION['pwd-reset']))
{
echo $_SESSION['pwd-reset'];
}else{
echo $_SESSION['pwd-reset'] = " ";
}
?> </p>
<div class="input-group">
<input type="password" placeholder="Password" name="password"required>
</div>
<div class="input-group">
<input type="password" placeholder="Confirm Password" name="cpassword" required>
</div>
<div class="input-group">
<button name="submit" class="btn">Update</button>
</div>
<p class="login-register-text">Remember Password ? <a href="login.php">Login Here</a>.</p>
</form>
</div>
</body>
</html>