Nouvelle version complète (remplacement total)

This commit is contained in:
2025-11-02 22:39:12 +01:00
commit 1a5e015663
14 changed files with 253 additions and 0 deletions

30
public/article.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
require_once '../includes/db.php';
require_once '../includes/header.php';
$id = $_GET['id'] ?? null;
if (!$id || !is_numeric($id)) {
echo "<p>Article introuvable (404)</p>";
require_once '../includes/footer.php';
exit;
}
$stmt = $pdo->prepare("SELECT * FROM articles WHERE id = ?");
$stmt->execute([$id]);
$article = $stmt->fetch();
if (!$article) {
echo "<p>Article introuvable (404)</p>";
require_once '../includes/footer.php';
exit;
}
?>
<article>
<h2><?= htmlspecialchars($article['titre']) ?></h2>
<p><?= nl2br(htmlspecialchars($article['contenu'])) ?></p>
<small>Publié le <?= $article['date_creation'] ?></small>
</article>
<?php require_once '../includes/footer.php'; ?>