Admin
This commit is contained in:
33
index.php
33
index.php
@@ -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
|
||||
============================================================ */
|
||||
|
||||
Reference in New Issue
Block a user