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

+ +
+ +
+
+ +
+ +