32 lines
813 B
PHP
32 lines
813 B
PHP
<?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'; ?>
|