Ajouter login.php

This commit is contained in:
2026-03-19 14:59:27 +00:00
parent c28140188d
commit 7c947ed0b0

32
login.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
session_start();
// TRAITEMENT DU FORMULAIRE
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
if ($username === "admin" && $password === "1234") {
$_SESSION['user'] = $username;
header("Location: dashboard.php");
exit();
} else {
$error = "Identifiants incorrects";
}
}
?>
<?php include 'include/header.php'; ?>
<h2>Connexion</h2>
<?php if(isset($error)) echo "<p>$error</p>"; ?>
<form method="POST">
<input type="text" name="username" placeholder="Nom d'utilisateur" required><br>
<input type="password" name="password" placeholder="Mot de passe" required><br>
<button type="submit">Se connecter</button>
</form>
<?php include 'include/footer.php'; ?>