dernier modif
This commit is contained in:
71
admin/board.php
Normal file
71
admin/board.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// Tableau de bord : liste des articles pour l'utilisateur connecté
|
||||
|
||||
require '../include/auth.php';
|
||||
require '../include/db.php';
|
||||
|
||||
requireLogin(); // Vérifie si l'utilisateur est connecté
|
||||
|
||||
// Récupère tous les articles, triés par date de création descendante
|
||||
$stmt = $pdo->query('SELECT * FROM articles ORDER BY date_creation DESC');
|
||||
$articles = $stmt->fetchAll();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tableau de Bord</title>
|
||||
<link rel="stylesheet" href="styleboard.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Header avec info utilisateur et déconnexion -->
|
||||
<header>
|
||||
<h1>Tableau de Bord</h1>
|
||||
<p>
|
||||
Connecté en tant que
|
||||
<?= htmlspecialchars($_SESSION['user'] ?? 'Invité') ?>
|
||||
| <a href="logout.php">Se déconnecter</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<hr>
|
||||
|
||||
<main>
|
||||
<!-- Section pour ajouter un article -->
|
||||
<h2>Gestion des articles</h2>
|
||||
<a href="ajouter.php">Ajouter un nouvel article</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Liste des articles existants -->
|
||||
<h3>Vos articles publiés</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Titre</th>
|
||||
<th>Date de création</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($articles as $article) : ?>
|
||||
<tr>
|
||||
<td><?= $article['id'] ?></td>
|
||||
<td><?= htmlspecialchars($article['titre']) ?></td>
|
||||
<td><?= $article['date_creation'] ?></td>
|
||||
<td>
|
||||
<a href="modifier.php?id=<?= $article['id'] ?>">Modifier</a> |
|
||||
<a href="supprimer.php?id=<?= $article['id'] ?>">Supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user