AJOUT CMS
This commit is contained in:
17
article.php
Normal file
17
article.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user