From 8351b0638ed0274b450c3ce4e992da948f045037 Mon Sep 17 00:00:00 2001
From: yanishimidi
Date: Tue, 4 Nov 2025 22:28:07 +0100
Subject: [PATCH] vertion avec les fichiers oublier
---
.DS_Store | Bin 6148 -> 6148 bytes
.gitignore | 4 ++++
public/.DS_Store | Bin 6148 -> 6148 bytes
public/delete.php | 45 +++++++++++++++++++++++++++++++++++++++++++++
public/index.php | 18 ++++++++++++++++++
public/style.css | 27 +++++++++++++++++++++++++++
6 files changed, 94 insertions(+)
create mode 100644 .gitignore
create mode 100644 public/delete.php
create mode 100644 public/index.php
create mode 100644 public/style.css
diff --git a/.DS_Store b/.DS_Store
index fae641e385ed6e603494e7a545428b5707d23161..d01120f6290260aaf1c7b1f299898cd038dd0003 100644
GIT binary patch
delta 38
mcmZoMXfas8%3)z_qN8AHVKn&woBd{Y)&KDGaF$IY3;(kUIGRlNcMrdIkoDd6Q=`*>Yww
zMOze^ca$XykgIs{N$vZ{3M_n0R{#}+08o4&MceR
IIsWnk0LPddJ^%m!
delta 39
vcmZoMXfc@J&&akhU^gQp+hiW5nUila8BMljPT72o*^p&o!|cuM9Dn%%0FDh`
diff --git a/public/delete.php b/public/delete.php
new file mode 100644
index 0000000..255bbad
--- /dev/null
+++ b/public/delete.php
@@ -0,0 +1,45 @@
+Article introuvable (404)
";
+ require_once '../includes/footer.php';
+ exit;
+}
+
+$stmt = $pdo->prepare("SELECT * FROM articles WHERE id = ?");
+$stmt->execute([$id]);
+$article = $stmt->fetch();
+
+if (!$article) {
+ echo "Article introuvable (404)
";
+ require_once '../includes/footer.php';
+ exit;
+}
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $stmt = $pdo->prepare("DELETE FROM articles WHERE id = ?");
+ $stmt->execute([$id]);
+ echo "Article supprimé avec succès.
";
+ echo 'Retour au tableau de bord';
+ require_once '../includes/footer.php';
+ exit;
+}
+?>
+
+Supprimer l'article
+Êtes-vous sûr de vouloir supprimer l'article "= htmlspecialchars($article['titre']) ?>" ?
+
+
+
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..dcd6b9b
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,18 @@
+query("SELECT id, titre, SUBSTRING(contenu,1,150) AS extrait, date_creation
+ FROM articles ORDER BY date_creation DESC LIMIT 10");
+?>
+Derniers articles
+fetch()): ?>
+
+
+ = htmlspecialchars($row['extrait']) ?>...
+ Publié le = $row['date_creation'] ?>
+
+
+
+
+
diff --git a/public/style.css b/public/style.css
new file mode 100644
index 0000000..7efc68d
--- /dev/null
+++ b/public/style.css
@@ -0,0 +1,27 @@
+body {
+ font-family: Arial, sans-serif;
+ margin: 0;
+ padding: 0;
+}
+
+header, footer {
+ background-color: #333;
+ color: #fff;
+ padding: 1rem;
+ text-align: center;
+}
+
+nav a {
+ color: #fff;
+ margin: 0 1rem;
+ text-decoration: none;
+}
+
+main {
+ padding: 2rem;
+}
+
+article {
+ border-bottom: 1px solid #ccc;
+ padding: 1rem 0;
+}