From 94f907abf2c0191946c810f5980a5357888f8e13 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 21 Jan 2020 19:22:22 +0100 Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20de=20supprimer=20un=20compte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server_files/controllers/informations.php | 3 ++- server_files/views/informations.php | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server_files/controllers/informations.php b/server_files/controllers/informations.php index c00e109..012a5e8 100644 --- a/server_files/controllers/informations.php +++ b/server_files/controllers/informations.php @@ -74,7 +74,8 @@ if (isset($_POST["delete_account"]) && $team == null && $_SESSION["role"] == Rol foreach ($user->getAllDocuments($team->getTournamentId()) as $document) unlink($LOCAL_PATH . "/files/" . $document->getFileId()); $DB->prepare("DELETE FROM `documents` WHERE `user` = ?;")->execute([$user->getId()]); - $DB->prepare("DELETE FROM `users` WHERE `id` = ?;")->execute([$user->getId()]); + $DB->prepare("DELETE FROM `organizers` WHERE `organizer` = ?;")->execute([$user->getId()]); + $DB->prepare("DELETE FROM `users` WHERE `id` = ?;")->execute([$user->getId()]); header("Location: /"); exit(); } diff --git a/server_files/views/informations.php b/server_files/views/informations.php index 7701f7b..800db2a 100644 --- a/server_files/views/informations.php +++ b/server_files/views/informations.php @@ -178,7 +178,15 @@ elseif (($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCA } } -if ($_SESSION["role"] == Role::ADMIN) { ?> +if ($_SESSION["role"] == Role::ADMIN) { + if ($user->getRole() != Role::ADMIN && $team == null) { ?> +
+ +
+ +
+