-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange-password.php
More file actions
103 lines (86 loc) · 3.48 KB
/
change-password.php
File metadata and controls
103 lines (86 loc) · 3.48 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
$msg = "";
include 'config.php';
if (isset($_GET['reset'])) {
if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM users WHERE code='{$_GET['reset']}'")) > 0) {
if (isset($_POST['submit'])) {
$password = mysqli_real_escape_string($connect, md5($_POST['password']));
$confirm_password = mysqli_real_escape_string($connect, md5($_POST['confirm-password']));
if ($password === $confirm_password) {
$query = mysqli_query($connect, "UPDATE users SET password='{$password}', code='' WHERE code='{$_GET['reset']}'");
if ($query) {
header("Location: index.php");
}
} else {
$msg = "<div class='alert alert-danger'>Password and Confirm Password do not match.</div>";
}
}
} else {
$msg = "<div class='alert alert-danger'>Reset Link do not match.</div>";
}
} else {
header("Location: forgot-password.php");
}
?>
<!DOCTYPE html>
<html lang="zxx">
<head>
<title>Login Form</title>
<!-- Meta tag Keywords -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8" />
<meta name="keywords"
content="Login Form" />
<!-- //Meta tag Keywords -->
<link href="//fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet">
<!--/Style-CSS -->
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<!--//Style-CSS -->
<script src="https://kit.fontawesome.com/af562a2a63.js" crossorigin="anonymous"></script>
</head>
<body>
<!-- form section start -->
<section class="w3l-mockup-form">
<div class="container">
<!-- /form -->
<div class="workinghny-form-grid">
<div class="main-mockup">
<div class="alert-close">
<span class="fa fa-close"></span>
</div>
<div class="w3l_form align-self">
<div class="left_grid_info">
<img src="images/image3.svg" alt="">
</div>
</div>
<div class="content-wthree">
<h2>Change Password</h2>
<p>please enter a new password</p>
<?php echo $msg; ?>
<form action="" method="post">
<input type="password" class="password" name="password" placeholder="Enter Your Password" required>
<input type="password" class="confirm-password" name="confirm-password" placeholder="Enter Your Confirm Password" required>
<button name="submit" class="btn" type="submit">Change Password</button>
</form>
<div class="social-icons">
<p>Back to! <a href="index.php">Login</a>.</p>
</div>
</div>
</div>
</div>
<!-- //form -->
</div>
</section>
<!-- //form section start -->
<script src="js/jquery.min.js"></script>
<script>
$(document).ready(function (c) {
$('.alert-close').on('click', function (c) {
$('.main-mockup').fadeOut('slow', function (c) {
$('.main-mockup').remove();
});
});
});
</script>
</body>
</html>