Initial commit - Mini CMS complet (PHP + Docker + MinIO)
This commit is contained in:
92
forum-project/article.php
Normal file
92
forum-project/article.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
$id = $_GET['id'] ?? null;
|
||||
if (!$id) {
|
||||
die("❌ Erreur : article introuvable.");
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("SELECT p.*, u.username, u.profile_picture FROM posts p JOIN utilisateurs u ON p.user_id = u.id WHERE p.id = ?");
|
||||
$stmt->execute([$id]);
|
||||
$post = $stmt->fetch();
|
||||
|
||||
if (!$post) {
|
||||
die("❌ Article non trouvé.");
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?= htmlspecialchars($post['title']) ?></title>
|
||||
<style>
|
||||
body {
|
||||
font-family: "Poppins", sans-serif;
|
||||
background: #fff6f8;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.article {
|
||||
max-width: 800px;
|
||||
margin: 60px auto;
|
||||
background: white;
|
||||
padding: 40px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 4px 15px rgba(255, 100, 150, 0.2);
|
||||
}
|
||||
h1 {
|
||||
color: #ff6f91;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.content {
|
||||
text-align: left;
|
||||
line-height: 1.7;
|
||||
font-size: 1.05em;
|
||||
color: #444;
|
||||
}
|
||||
.meta {
|
||||
margin-top: 25px;
|
||||
color: #777;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
a {
|
||||
display: inline-block;
|
||||
margin-top: 30px;
|
||||
color: #ff6f91;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="article">
|
||||
<h1><?= htmlspecialchars($post['title']) ?></h1>
|
||||
|
||||
<?php if (!empty($post['image_url'])): ?>
|
||||
<img src="<?= htmlspecialchars($post['image_url']) ?>" alt="Illustration de l'article">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="content">
|
||||
<?= nl2br(htmlspecialchars($post['content'])) ?>
|
||||
</div>
|
||||
|
||||
<div class="meta">
|
||||
🕒 <?= $post['date_creation'] ?> — ✍️ <?= htmlspecialchars($post['username']) ?>
|
||||
</div>
|
||||
|
||||
<a href="index.php">⬅ Retour à la liste des articles</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user