Actualiser login.php
This commit is contained in:
31
login.php
31
login.php
@@ -1,12 +1,21 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// TRAITEMENT DU FORMULAIRE
|
||||
// Traitement du formulaire
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$username = '';
|
||||
$password = '';
|
||||
|
||||
if (isset($_POST['username'])) {
|
||||
$username = $_POST['username'];
|
||||
}
|
||||
|
||||
if (isset($_POST['password'])) {
|
||||
$password = $_POST['password'];
|
||||
}
|
||||
|
||||
// Vérification
|
||||
if ($username === "admin" && $password === "1234") {
|
||||
$_SESSION['user'] = $username;
|
||||
header("Location: dashboard.php");
|
||||
@@ -21,12 +30,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
<h2>Connexion</h2>
|
||||
|
||||
<?php if(isset($error)) echo "<p>$error</p>"; ?>
|
||||
<?php
|
||||
if (isset($error)) {
|
||||
echo "<p style='color:red;'>$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>
|
||||
|
||||
<label for="username">Nom d'utilisateur :</label><br>
|
||||
<input type="text" id="username" name="username" required><br><br>
|
||||
|
||||
<label for="password">Mot de passe :</label><br>
|
||||
<input type="password" id="password" name="password" required><br><br>
|
||||
|
||||
<button type="submit">Se connecter</button>
|
||||
|
||||
</form>
|
||||
|
||||
<?php include 'include/footer.php'; ?>
|
||||
Reference in New Issue
Block a user