1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 07:42:22 +00:00

Possibilité de supprimer un compte

This commit is contained in:
Yohann D'ANELLO 2020-01-21 19:22:22 +01:00
parent 6fe398d965
commit 94f907abf2
2 changed files with 11 additions and 2 deletions

View File

@ -74,7 +74,8 @@ if (isset($_POST["delete_account"]) && $team == null && $_SESSION["role"] == Rol
foreach ($user->getAllDocuments($team->getTournamentId()) as $document) foreach ($user->getAllDocuments($team->getTournamentId()) as $document)
unlink($LOCAL_PATH . "/files/" . $document->getFileId()); unlink($LOCAL_PATH . "/files/" . $document->getFileId());
$DB->prepare("DELETE FROM `documents` WHERE `user` = ?;")->execute([$user->getId()]); $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: /"); header("Location: /");
exit(); exit();
} }

View File

@ -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) { ?>
<hr/>
<form method="POST">
<input type="submit" name="delete_account" class="btn btn-secondary btn-lg btn-block"
style="background-color: #ff2e34" value="Supprimer le compte"/>
</form>
<?php } ?>
<hr /> <hr />
<form method="POST"> <form method="POST">
<input type="submit" name="view_as" class="btn btn-secondary btn-lg btn-block" style="background-color: #2ba42b" <input type="submit" name="view_as" class="btn btn-secondary btn-lg btn-block" style="background-color: #2ba42b"