first commit

This commit is contained in:
2025-11-02 17:57:39 +01:00
commit d5330c0eb0
21 changed files with 1243 additions and 0 deletions

50
index.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
include 'include/db.php';
$sql = "SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10";
$result = $pdo->query($sql);
$articles = $result->fetchAll();
?>
<!-- Page Principal -->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Accueil - Un CMS Quoi</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<header>
<nav>
<a href="index.php">Un Accueil qui Accueil</a> |
<a href="admin/connexion.php">Administration</a>
</nav>
</header>
<main>
<h1>Articles Publiés</h1>
<?php
if (count($articles) == 0) {
echo "<p>Aucun article trouvé pour le moment.</p>";
} else {
foreach ($articles as $a) {
echo "<article>";
echo "<h2><a href='article.php?id=" . $a['id'] . "'>" . htmlspecialchars($a['titre']) . "</a></h2>";
echo "<small>Publie le " . date("d/m/Y", strtotime($a['date_creation'])) . "</small>";
echo "<p>" . substr(htmlspecialchars($a['contenu']), 0, 200) . "...</p>";
echo "<p><a href='article.php?id=" . $a['id'] . "'>Lire la suite</a></p>";
echo "</article>";
}
}
?>
</main>
<footer>
<p>&copy; <?php echo date("Y"); ?> - Un CMS qui peut nous mener a la victoire</p>
</footer>
</body>
</html>