Refonte complète du projet

This commit is contained in:
2025-11-02 19:53:50 +01:00
commit 20df067b19
16 changed files with 326 additions and 0 deletions

34
public/login.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
session_start();
require_once '../includes/db.php';
require_once '../includes/header.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$login = $_POST['login'] ?? '';
$password = $_POST['password'] ?? '';
$stmt = $pdo->prepare("SELECT * FROM utilisateur WHERE login = ?");
$stmt->execute([$login]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user'] = $user['login'];
header("Location: admin.php");
exit;
} else {
$error = "Identifiants incorrects";
}
}
?>
<h2>Connexion administrateur</h2>
<?php if (!empty($error)) echo "<p style='color:red;'>$error</p>"; ?>
<form method="post">
<label>Login :</label><br>
<input type="text" name="login" required><br><br>
<label>Mot de passe :</label><br>
<input type="password" name="password" required><br><br>
<input type="submit" value="Se connecter">
</form>
<?php require_once '../includes/footer.php'; ?>