Suppression d'un utilisateur
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user