-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangepassword.php
98 lines (83 loc) · 2.99 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
87
88
89
90
91
92
93
94
95
96
97
98
<?php require_once("./controller/deps.php"); ?>
<?php header_section("Dashboard | Change Password"); ?>
<?php
if ($_SESSION['login'] == false) {
header("Location: login.php");
exit();
}
$errors_message = [];
$success_message = "";
if (isset($_GET['success'])) {
if ($_GET['success'] == "true") {
// var_dump($_GET);
$success_message = "Successfully Change the Password";
}
}
if (isset($_GET['errors'])) {
$errors_code = explode(",", $_GET['errors']);
foreach ($errors_code as $error) {
if ($error == "cpassword") {
array_push($errors_message, "Current Password is not matched");
}
if ($error == "npassword") {
array_push($errors_message, "Password must be larger than 8 character, include at least one of them (@, #, $, %)");
}
if ($error == "ccpassword") {
array_push($errors_message, "Confirm Password didn't match your Password");
}
}
}
?>
<main class="clearfix">
<?php if (count($errors_message)) : ?>
<div class="errors-list">
<table>
<tbody>
<?php foreach ($errors_message as $err_msg) : ?>
<tr>
<td>!! <?php echo $err_msg; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if (!empty($success_message)) : ?>
<div class="success">
<table>
<tbody>
<tr>
<td><?php echo $success_message; ?></td>
</tr>
</tbody>
</table>
</div>
<?php endif; ?>
<form action="./controller/changepass.php" method="post">
<input type="hidden">
<table>
<tbody>
<tr>
<td><label for="cpassword">Current Password</label></td>
<td><input class="inp" id="cpassword" type="password" name="cpassword" onkeyup="validateCurrentPass(this)"></td>
<td class="err-msg"></td>
</tr>
<tr>
<td><label for="npassword">New Password</label></td>
<td><input class="inp" id="npassword" type="password" name="npassword" onkeyup="validateNPassword(this)"></td>
<td class="err-msg"></td>
</tr>
<tr>
<td><label for="ccpassword">Confirm Password</label></td>
<td><input class="inp" id="ccpassword" type="password" name="ccpassword" onkeyup="validateCCPassword(this)"></td>
<td class="err-msg"></td>
</tr>
<tr>
<td></td>
<td><button class="btn" id="changepassword" type="submit" name="changepass">Change Password</button></td>
</tr>
</tbody>
</table>
</form>
</main>
<?php footer_section(); ?>