Initial commit

This commit is contained in:
2025-11-01 21:47:32 +01:00
commit a32bed95dc
16 changed files with 514 additions and 0 deletions

44
admin/delete.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
require '../include/db.php';
require '../include/authenticator.php';
requireLogin();
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($id <= 0) {
header('Location:board.php');
exit;
}
$stmt = $pdo->prepare('SELECT id, titre FROM articles WHERE id = :id');
$stmt->execute([':id' => $id]);
$article = $stmt->fetch();
if (!$article) {
header('Location: board.php');
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['confirm']) && $_POST['confirm'] === 'yes') {
$d = $pdo->prepare('DELETE FROM articles WHERE id = :id');
$d->execute([':id' => $id]);
}
header('Location: board.php');
exit;
}
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Supprimer l'article</title>
<link rel="stylesheet" href="/assets/style.css">
</head>
<body>
<h1>Supprimer l'article</h1>
<p>Êtes-vous sûr de vouloir supprimer : <strong><?= htmlspecialchars($article['titre']) ?></strong> ?</p>
<form method="post">
<button type="submit" name="confirm" value="yes">Oui, supprimer</button>
<a href="board.php">Annuler</a>
</form>
</body>
</html>