-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteAccount.php
More file actions
39 lines (33 loc) · 1 KB
/
DeleteAccount.php
File metadata and controls
39 lines (33 loc) · 1 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
<?php
require_once 'Include/Load.php';
$session = App::getSession();
$link = App::getDatabase();
$user = App::getUser();
$validator = App::getValidator();
$user->restrict();
if ($validator->isPosted()){
$result = $link->query('SELECT * FROM users WHERE id = :id', [
'id' => $session->getKey('user_infos')->id
])->fetch();
if ($user->deleteAccount($result, $_POST['password'])) {
$session->setFlash('success', 'Your Account has been successfully deleted');
App::redirect('Login.php');
} else {
$session->setFlash('alert', "Your Account's Password is incorrect");
}
}
?>
<?php require_once 'Include/Header.php'; ?>
<div class="login-box">
<h2>Delete Account</h2>
<form action="" method="post">
<div class="user-box">
<input type="password" name="password" required="">
<label>Password</label>
</div>
<button type="submit">Submit</button>
</form>
</div>
<?php require_once 'Include/Mode.php'; ?>
</body>
</html>