40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
require __DIR__ . '/../inc/db.php';
|
|
$id=filter_input(INPUT_GET,'id',FILTER_VALIDATE_INT);
|
|
if(!$id){http_response_code(404);exit('404 - Article non trouvé');}
|
|
$stmt=$pdo->prepare("SELECT id,titre,contenu,date_creation FROM articles WHERE id=?");
|
|
$stmt->execute([$id]);
|
|
$article=$stmt->fetch();
|
|
if(!$article){http_response_code(404);exit('404 - Article non trouvé');}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title><?= htmlspecialchars($article['titre']) ?></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="assets/style.css" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar">
|
|
<div class="container container-narrow">
|
|
<a class="navbar-brand fw-semibold" href="/">CMS Simplifié</a>
|
|
<a class="btn btn-sm btn-light" href="/">Accueil</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container container-narrow py-4">
|
|
<div class="card p-4">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h1 class="h3 mb-2"><?= htmlspecialchars($article['titre']) ?></h1>
|
|
<span class="badge badge-date"><?= htmlspecialchars($article['date_creation']) ?></span>
|
|
</div>
|
|
<div class="mt-3"><?= nl2br(htmlspecialchars($article['contenu'])) ?></div>
|
|
</div>
|
|
<div class="mt-3">
|
|
<a class="btn btn-outline-secondary btn-sm" href="/">← Retour</a>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|