18 lines
591 B
PHP
18 lines
591 B
PHP
<?php
|
|
require 'include/db.php';
|
|
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
|
$stmt = $pdo->prepare('SELECT * FROM articles WHERE id = ?');
|
|
$stmt->execute([$id]);
|
|
$article = $stmt->fetch();
|
|
if (!$article) { http_response_code(404); die('<h1>404 - Article introuvable</h1>'); }
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head><meta charset="UTF-8"><title><?= htmlspecialchars($article['titre']) ?></title></head>
|
|
<body>
|
|
<h1><?= htmlspecialchars($article['titre']) ?></h1>
|
|
<p><?= nl2br(htmlspecialchars($article['contenu'])) ?></p>
|
|
<a href="index.php">Retour</a>
|
|
</body>
|
|
</html>
|