This commit is contained in:
leosw
2025-12-26 12:02:42 +01:00
parent 7b79a7744a
commit 0faf933118

View File

@@ -228,6 +228,9 @@ body { max-width: 900px; margin: 40px auto; }
<?php if (is_logged()): ?>
<a href="index.php?action=edit">Mon matériel</a>
<a href="index.php?action=profile">Mon profil</a>
<?php if (isset($_SESSION['owner_id']) && $_SESSION['owner_id'] == 1): ?>
<a href="index.php?action=admin">Admin</a>
<?php endif; ?>
<a href="index.php?action=logout">Déconnexion</a>
<?php else: ?>
<a href="index.php?action=login">Connexion</a>
@@ -407,6 +410,36 @@ if ($action === 'register') {
<?php
}
/* ============================================================
VUE : INSCRIPTION
============================================================ */
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);
?>
<h2>Administration — Utilisateurs</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $u): ?>
<tr>
<td><?= htmlspecialchars($u['id']) ?></td>
<td><?= htmlspecialchars($u['name']) ?></td>
<td><?= htmlspecialchars($u['email']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
}
/* ============================================================
VUE : PROFIL
============================================================ */