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; +} +?> + +

Supprimer l'article

+

Êtes-vous sûr de vouloir supprimer l'article "" ?

+
+ + Annuler +
+ + 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()): ?> +
+

+

...

+ Publié le +
+
+ + + 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; +}