From 254d4012383ed6c685682e4d595976d88e3912b1 Mon Sep 17 00:00:00 2001 From: rubisalpha Date: Thu, 30 Oct 2025 11:47:11 +0000 Subject: [PATCH] Ajouter admin/add.php --- admin/add.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 admin/add.php diff --git a/admin/add.php b/admin/add.php new file mode 100644 index 0000000..854b56e --- /dev/null +++ b/admin/add.php @@ -0,0 +1,40 @@ + 255) $errors[] = 'Le titre est trop long.'; + if (empty($errors)) { + $stmt = $pdo->prepare('INSERT INTO articles (titre, contenu, date_creation) VALUES (:titre, :contenu, NOW())'); + $stmt->execute(['titre' => $titre, 'contenu' => $contenu]); + flash_set('success', 'Article ajouté.'); + header('Location: /admin/dashboard.php'); + exit; + } +} +$token = csrf_token(); +?> + +Ajouter un article + + +

Ajouter un article

+ +
+ +
+
+ +
+ +