-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupprimer-compte.php
executable file
·57 lines (46 loc) · 1.6 KB
/
supprimer-compte.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
<?php
session_start();
if (!isset($_SESSION['is_logged'])) {
header('Location: index.php');
die();
}
if (isset($_POST['delete-confirm'])) {
require_once('db_connect.php');
$sql = 'DELETE FROM users WHERE id = :id';
$delete = $pdo->prepare($sql);
$delete->execute([
'id' => $_SESSION['logged_user_id']
]);
if ($delete) {
unlink('uploads/pfp/' . $_SESSION['logged_user_id'] . '_pfp.png');
header('Location: deconnexion.php');
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modifier les Informations de Profil | Livre d'Or</title>
<link rel="stylesheet" href="font/webfont.css">
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<script src="https://kit.fontawesome.com/42d5a324f0.js" crossorigin="anonymous"></script>
</head>
<body>
<?php require_once('elements/header.php'); ?>
<main>
<div class="container form-container">
<form action="" method="post" id="delete-confirm">
<h2>Voulez-vous vraiment supprimer votre compte ?</h2>
<p class="form-paragraph">Tous vos commentaires seront supprimés.<br />
Cette action n'est pas réversible.</p>
<input type="submit" id="delete" name="delete-confirm" value="Supprimer">
</form>
</div>
</main>
<?php require_once('elements/footer.php'); ?>
</body>
</html>