From 7ed9c18c3955d72d4dca4d452e821dbbff228a60 Mon Sep 17 00:00:00 2001 From: leosw Date: Sat, 27 Dec 2025 20:14:04 +0100 Subject: [PATCH] Admin delete user --- index.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 906db98..02cc717 100644 --- a/index.php +++ b/index.php @@ -462,13 +462,19 @@ if ($action === 'register') { } /* ============================================================ - VUE : INSCRIPTION + VUE : ADMINISTRATION ============================================================ */ if ($action === 'admin' && isset($_SESSION['owner_id']) && $_SESSION['owner_id'] == 1) { $users = $db->query("SELECT id, name, email FROM owners ORDER BY id ASC")->fetchAll(PDO::FETCH_ASSOC); ?>

Administration — Utilisateurs

+Utilisateur supprimé.'; +} +?> + @@ -483,6 +489,7 @@ if ($action === 'admin' && isset($_SESSION['owner_id']) && $_SESSION['owner_id'] + @@ -494,6 +501,22 @@ if ($action === 'admin' && isset($_SESSION['owner_id']) && $_SESSION['owner_id'] 0) { + $stmt = $pdo->prepare("DELETE FROM users WHERE id = ?"); + $stmt->execute([$id]); + } + + header("Location: index.php?action=list_users&deleted=1"); + exit; +} + + /* ============================================================ VUE : PROFIL ============================================================ */
Supprimer