Suppression d'un utilisateur

This commit is contained in:
leosw
2025-12-27 20:23:08 +01:00
parent 7ed9c18c39
commit 2a303cae0b
2 changed files with 5 additions and 4 deletions

BIN
db.sqlite Normal file → Executable file

Binary file not shown.

View File

@@ -481,6 +481,7 @@ if (!empty($_GET['deleted'])) {
<th>ID</th>
<th>Nom</th>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -489,7 +490,7 @@ if (!empty($_GET['deleted'])) {
<td><?= htmlspecialchars($u['id']) ?></td>
<td><?= htmlspecialchars($u['name']) ?></td>
<td><?= htmlspecialchars($u['email']) ?></td>
<td> <a href="index.php?action=delete_user&id=<?= $user['id'] ?>" onclick="return confirm('Supprimer cet utilisateur ?');" class="btn btn-danger"> Supprimer </a> </td>
<td> <a href="index.php?action=delete_user&id=<?= $u['id'] ?>" onclick="return confirm('Supprimer cet utilisateur ?');" class="btn btn-danger"> Supprimer </a> </td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -507,12 +508,12 @@ if (!empty($_GET['deleted'])) {
if ($action === 'delete_user' && isset($_SESSION['owner_id']) && $_SESSION['owner_id'] == 1) {
$id = intval($_GET['id'] ?? 0);
if ($id > 0) {
$stmt = $pdo->prepare("DELETE FROM users WHERE id = ?");
if ($id > 1) {
$stmt = $db->prepare("DELETE FROM owners WHERE id = ?");
$stmt->execute([$id]);
}
header("Location: index.php?action=list_users&deleted=1");
header("Location: index.php?action=admin&deleted=1");
exit;
}