This commit is contained in:
No4m
2025-11-02 14:05:02 +01:00
parent 9187f41e17
commit f2b78086dd
13 changed files with 122 additions and 74 deletions

View File

@@ -1,7 +1,6 @@
<?php
global $pdo, $pdo;
require '../include/db.php';
require '../include/authenticator.php';
require '../include/auth.php';
requireLogin();
$errors = [];
@@ -26,23 +25,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Ajouter un article</title>
<link rel="stylesheet" href="/assets/style.css">
</head>
<body>
<h1>Ajouter un article</h1>
<?php foreach ($errors as $e): ?>
<p class="error"><?= htmlspecialchars($e) ?></p>
<?php endforeach; ?>
<form method="post">
<label>Titre<br><input type="text" name="titre" value="<?= htmlspecialchars($titre) ?>" required></label><br>
<label>Contenu<br><textarea name="contenu" rows="10" required><?= htmlspecialchars($contenu) ?></textarea></label><br>
<button type="submit">Publier</button>
<a href="board.php">Annuler</a>
</form>
</body>
<head>
<meta charset="utf-8">
<title>Ajouter un article</title>
<link rel="stylesheet" href="/assets/style.css">
</head>
<body>
<h1>Ajouter un article</h1>
<?php foreach ($errors as $e): ?>
<p class="error"><?= htmlspecialchars($e) ?></p>
<?php endforeach; ?>
<form method="post">
<label>Titre<br><input type="text" name="titre" value="<?= htmlspecialchars($titre) ?>" required></label><br>
<label>Contenu<br><textarea name="contenu" rows="10" required><?= htmlspecialchars($contenu) ?></textarea></label><br>
<button type="submit">Publier</button>
<a href="board.php">Annuler</a>
</form>
</body>
</html>

View File

@@ -1,29 +1,29 @@
<?php
global $pdo;
require '../include/db.php';
require '../include/authenticator.php';
require '../include/auth.php';
requireLogin();
$stmt = $pdo->query('SELECT * FROM articles ORDER BY date_creation DESC');
$articles = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="fr">
<head><meta charset="UTF-8"><title>Admin - Tableau de bord</title></head>
<body>
<h1>Tableau de bord</h1>
<a href="add.php">Ajouter un article</a> | <a href="logout.php">Se déconnecter</a>
<table border="1">
<tr><th>ID</th><th>Titre</th><th>Actions</th></tr>
<?php foreach ($articles as $a): ?>
<tr>
<td><?= $a['id'] ?></td>
<td><?= htmlspecialchars($a['titre']) ?></td>
<td>
<a href="modif.php?id=<?= $a['id'] ?>">Modifier</a> |
<a href="delete.php?id=<?= $a['id'] ?>">Supprimer</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
<body>
<h1>Tableau de bord</h1>
<a href="add.php">Ajouter un article</a> | <a href="logout.php">Se déconnecter</a>
<table border="1">
<tr><th>ID</th><th>Titre</th><th>Actions</th></tr>
<?php foreach ($articles as $a): ?>
<tr>
<td><?= $a['id'] ?></td>
<td><?= htmlspecialchars($a['titre']) ?></td>
<td>
<a href="modif.php?id=<?= $a['id'] ?>">Modifier</a> |
<a href="delete.php?id=<?= $a['id'] ?>">Supprimer</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>

View File

@@ -1,7 +1,6 @@
<?php
global $pdo;
require '../include/db.php';
require '../include/authenticator.php';
require '../include/auth.php';
requireLogin();
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
@@ -27,19 +26,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
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>
<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>

View File

@@ -1,7 +1,6 @@
<?php
global $pdo;
require '../include/db.php';
require '../include/authenticator.php';
require '../include/auth.php';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
@@ -13,16 +12,17 @@ $error = 'Identifiants incorrects';
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head><meta charset="UTF-8"><title>Connexion</title></head>
<body>
<h1>Connexion</h1>
<form method="post">
<input type="text" name="login" placeholder="Login" required><br>
<input type="password" name="password" placeholder="Mot de passe" required><br>
<button type="submit">Se connecter</button>
</form>
<p style="color:red;"><?= $error ?></p>
</body>
<body>
<h1>Connexion</h1>
<form method="post">
<input type="text" name="login" placeholder="Login" required><br>
<input type="password" name="password" placeholder="Mot de passe" required><br>
<button type="submit">Se connecter</button>
</form>
<p style="color:red;"><?= $error ?></p>
</body>
</html>