100%
This commit is contained in:
@@ -6,9 +6,13 @@ if (!isset($_SESSION['user_id'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$user_login = $_SESSION['user_login'];
|
||||
|
||||
require_once 'php/pdo.php';
|
||||
$sql = "SELECT * FROM articles ORDER BY date_creation DESC";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute();
|
||||
$articles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
@@ -19,21 +23,46 @@ $user_login = $_SESSION['user_login'];
|
||||
|
||||
<header>
|
||||
<h1>Tableau de Bord</h1>
|
||||
<p>Bienvenue, <?php echo htmlspecialchars($user_login); ?> ! (ID: <?php echo $_SESSION['user_id']; ?>)</p>
|
||||
<nav>
|
||||
<a href="logout.php">Se déconnecter</a>
|
||||
</nav>
|
||||
<p>
|
||||
Connecté en tant que <?php print htmlspecialchars($_SESSION['user_login']); ?>
|
||||
| <a href="logout.php">Se déconnecter</a>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<hr>
|
||||
|
||||
<main>
|
||||
<h2>Gestion des articles</h2>
|
||||
<p>C'est ici que vous pourrez bientôt gérer vos articles.</p>
|
||||
<a href="creation_article.php">Ajouter un nouvel article</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="creer_article.php">Ajouter un nouvel article</a></li>
|
||||
</ul>
|
||||
<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="modif.php?id=<?php echo $article['id']; ?>">Modifier</a>
|
||||
|
|
||||
<a href="supp.php?id=<?php echo $article['id']; ?>">Supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user