69 lines
1.9 KiB
PHP
69 lines
1.9 KiB
PHP
<?php
|
|
require '../include/db.php';
|
|
require '../include/auth.php';
|
|
requireLogin();
|
|
$stmt = $pdo->query('SELECT * FROM articles ORDER BY date_creation DESC');
|
|
$articles = $stmt->fetchAll();
|
|
?>
|
|
<!-- Page Du Tableau de board -->
|
|
<!DOCTYPE html>
|
|
<html lang="fr" dir="ltr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Tableau de Bord</title>
|
|
<link rel="stylesheet" href="styleboard.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<h1>Tableau de Bord de bordination</h1>
|
|
<p>
|
|
Connecté en tant que
|
|
<?php
|
|
echo htmlspecialchars($_SESSION['user_login'] ?? 'Invité');
|
|
?>
|
|
<!-- retourne a la page de deconnexion -->
|
|
| <a href="deconnexion.php">Se déconnecter</a>
|
|
</p>
|
|
|
|
</header>
|
|
|
|
<hr>
|
|
|
|
<main>
|
|
<!-- Page pour ajouter un article -->
|
|
<h2>Gestion des articles</h2>
|
|
<a href="ajouter.php">Ajouter un nouvel article</a>
|
|
|
|
<hr>
|
|
|
|
<h3>Vos articles publiés</h3>
|
|
|
|
<table border="1">
|
|
<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><?php echo $article['id']; ?></td>
|
|
<td><?php echo htmlspecialchars($article['titre']); ?></td>
|
|
<td><?php echo $article['date_creation']; ?></td>
|
|
<td>
|
|
<a href="modification.php?id=<?php echo $article['id']; ?>">Modifier</a>
|
|
|
|
|
<a href="supprimer.php?id=<?php echo $article['id']; ?>">Supprimer</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</main>
|
|
|
|
</body>
|
|
</html>
|