50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
// Fichier de connexion utilisateur
|
|
|
|
require '../include/db.php'; // Connexion à la base
|
|
require '../include/auth.php'; // Fonctions d'authentification
|
|
|
|
$error = ''; // Message d'erreur
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
// Récupération sécurisée des données du formulaire
|
|
$login = $_POST['login'] ?? '';
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
// Vérification des identifiants
|
|
if (checkLogin($pdo, $login, $password)) {
|
|
// Connexion réussie → redirection vers le tableau de bord
|
|
header('Location: board.php');
|
|
exit;
|
|
} else {
|
|
$error = 'Identifiants incorrects';
|
|
}
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Connexion</title>
|
|
<link rel="stylesheet" href="stylelog.css">
|
|
</head>
|
|
<body>
|
|
|
|
<h1>Connexion</h1>
|
|
|
|
<!-- Formulaire de connexion -->
|
|
<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>
|
|
|
|
<!-- Affichage du message d'erreur si nécessaire -->
|
|
<?php if ($error): ?>
|
|
<p class="error"><?= htmlspecialchars($error) ?></p>
|
|
<?php endif; ?>
|
|
|
|
</body>
|
|
</html>
|