Refonte complète du projet
This commit is contained in:
29
public/article.php
Normal file
29
public/article.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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'; ?>
|
||||
Reference in New Issue
Block a user