Ajouter login.php
This commit is contained in:
32
login.php
Normal file
32
login.php
Normal 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'; ?>
|
||||
Reference in New Issue
Block a user