forked from SWU-Karabast/SWUOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangePassword.php
86 lines (74 loc) · 2.41 KB
/
ChangePassword.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
<?php
include_once 'MenuBar.php';
include_once './AccountFiles/AccountDatabaseAPI.php';
if (!isset($_SESSION['userid'])) {
header('Location: ./MainMenu.php');
die();
}
// Check if the user is banned
if (isset($_SESSION["userid"]) && IsBanned($_SESSION["userid"])) {
header("Location: ./PlayerBanned.php");
exit;
}
?>
<?php
include_once 'Header.php';
?>
<div class="core-wrapper">
<div class="flex-padder"></div>
<div class="flex-wrapper">
<div class='container bg-black'>
<section class="change-password-form">
<h2>Change Your Password</h2>
<div class="change-password-form-form">
<form action="includes/change-password.inc.php" method="post">
<div>
<label for="currentpwd">Current Password</label>
<input type="password" name="currentpwd" id="currentpwd">
</div>
<div>
<label for="newpwd">New Password</label>
<input type="password" name="newpwd" id="newpwd">
</div>
<div>
<label for="confirmnewpwd">Confirm New Password</label>
<input type="password" name="confirmnewpwd" id="confirmnewpwd">
</div>
<div style="text-align:center;">
<button type="submit" name="submit">Change</button>
</div>
</form>
</div>
<?php
// Error messages
if (isset($_GET["error"])) {
if ($_GET["error"] == "emptyinput") {
echo "<h3 class='change-password-error-message'>Fill in all fields!</h3>";
} else if ($_GET["error"] == "wrongpassword") {
echo "<h3 class='change-password-error-message'>Incorrect current password!</h3>";
} else if ($_GET["error"] == "passwordsdontmatch") {
echo "<h3 class='change-password-error-message'>Passwords don't match!</h3>";
} else if ($_GET["error"] == "stmtfailed") {
echo "<h3 class='change-password-error-message'>Something went wrong!</h3>";
} else if ($_GET["error"] == "none") {
echo "<h3 class='change-password-error-message'>Your password has been changed!</h3>";
}
}
?>
</section>
</div>
</div>
<div class="flex-padder"></div>
</div>
<script>
function showPopupAndRedirect() {
alert("Your password has been successfully changed! Please log in with your new password.");
window.location.href = "./AccountFiles/LogoutUser.php?redirect=login";
}
<?php if (isset($_GET["error"]) && $_GET["error"] == "none") { ?>
window.onload = showPopupAndRedirect;
<?php } ?>
</script>
<?php
include_once 'Disclaimer.php';
?>