= htmlspecialchars($row['titre']) ?>
+= htmlspecialchars($row['extrait']) ?>...
+ Publié le = $row['date_creation'] ?> +diff --git a/.DS_Store b/.DS_Store index fae641e..d01120f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2bb40ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +includes/config.local.php +public/.DS_Store +.DS_Store diff --git a/public/.DS_Store b/public/.DS_Store index 93df429..b112d95 100644 Binary files a/public/.DS_Store and b/public/.DS_Store differ 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; +} +?> + +Ê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"); +?> += htmlspecialchars($row['extrait']) ?>...
+ Publié le = $row['date_creation'] ?> +