Téléverser les fichiers vers "article-index-css"

This commit is contained in:
2025-11-02 20:31:16 +00:00
parent 09ab3dbc6d
commit d14faa1c4b
3 changed files with 134 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
require 'includes/db.php';
include 'includes/header.php';
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
die("<h2>Erreur 404 - Article introuvable</h2>");
}
$id = (int) $_GET['id'];
$stmt = $pdo->prepare("SELECT * FROM articles WHERE id = ?");
$stmt->execute([$id]);
$article = $stmt->fetch();
if (!$article) {
echo "<h2>Erreur 404 - Article introuvable</h2>";
} else {
echo "<h2>" . htmlspecialchars($article['titre']) . "</h2>";
echo "<p>" . nl2br(htmlspecialchars($article['contenu'])) . "</p>";
}
include 'includes/footer.php';
?>

View File

@@ -0,0 +1,22 @@
<?php
require 'includes/db.php';
include 'includes/header.php';
$sql = "SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10";
$stmt = $pdo->query($sql);
$articles = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<h2>Derniers articles</h2>
<?php if (empty($articles)): ?>
<p>Aucun article pour le moment.</p>
<?php else: ?>
<?php foreach ($articles as $a): ?>
<h3><a href="article.php?id=<?= $a['id'] ?>"><?= htmlspecialchars($a['titre']) ?></a></h3>
<p><?= substr(htmlspecialchars($a['contenu']), 0, 150) ?>...</p>
<hr>
<?php endforeach; ?>
<?php endif; ?>
<?php include 'includes/footer.php'; ?>

View File

@@ -0,0 +1,90 @@
/* === STYLE GLOBAL === */
body {
font-family: Arial, sans-serif;
background-color: #1111b9;
margin: 0;
padding: 0;
color: #333;
}
/* === HEADER & TITRES === */
h1, h2, h3 {
text-align: center;
color: #2c3e50;
}
/* === FORMULAIRES === */
form {
max-width: 400px;
margin: 20px auto;
padding: 70px;
background-color: white;
border-radius: 30px;
}
input[type="text"], input[type="password"], textarea {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #a7c2d3;
color: rgb(214, 89, 89);
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
}
button:hover {
background-color: #a11d1d;
}
/* === TABLEAUX === */
table {
border-collapse: collapse;
width: 90%;
margin: 20px auto;
background-color: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
th, td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}
th {
background-color: #792020;
color: rgb(163, 31, 31);
}
/* === LIENS === */
a {
text-decoration: none;
color: #bd1212;
font-weight: bold;
}
a:hover {
text-decoration: underline;
}
/* === MESSAGES === */
p {
text-align: center;
font-weight: bold;
}
p[style*="color:green"] {
color: #27ae60 !important;
}
p[style*="color:red"] {
color: #e74c3c !important;
}