2024-06-14 18:42:40 +02:00
|
|
|
<html lang="fr" >
|
2024-06-13 19:50:01 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<link rel="icon" href="../img/jo2024.jpg" >
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<title>Connexion - Jeux Olympiques</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
2024-06-10 19:29:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Informations de connexion à la base de données
|
2024-06-11 11:27:58 +02:00
|
|
|
require_once 'common.php';
|
|
|
|
session_start();
|
2024-06-14 18:42:40 +02:00
|
|
|
if (!empty($_POST['login']) && !empty($_POST['password'])) {
|
2024-06-11 11:27:58 +02:00
|
|
|
$db = initDatabase();
|
|
|
|
$login = $_POST['login'];
|
|
|
|
$password = $_POST['password'];
|
2024-06-14 18:42:40 +02:00
|
|
|
|
2024-06-10 19:29:21 +02:00
|
|
|
|
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
$result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
|
2024-06-10 19:29:21 +02:00
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
if (mysqli_num_rows($result) > 0) {
|
2024-06-10 19:29:21 +02:00
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
$hash = $row['mdp'];
|
2024-06-14 18:42:40 +02:00
|
|
|
$mail = $row['mail'];
|
2024-06-15 17:47:50 +02:00
|
|
|
$nom = $row['nom'];
|
|
|
|
$prenom = $row['prenom'];
|
|
|
|
$genre = $row['genre'];
|
2024-06-14 18:42:40 +02:00
|
|
|
$role = $row ['Role'];
|
2024-06-10 19:29:21 +02:00
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
if (password_verify($password, $hash)) {
|
|
|
|
if ($login) {
|
|
|
|
$_SESSION['login'] = $login;
|
2024-06-14 18:42:40 +02:00
|
|
|
$_SESSION['mail'] = $mail;
|
2024-06-15 17:47:50 +02:00
|
|
|
$_SESSION['nom'] = $nom;
|
|
|
|
$_SESSION['prenom'] = $prenom;
|
|
|
|
$_SESSION['genre'] = $genre;
|
2024-06-14 18:42:40 +02:00
|
|
|
$_SESSION['role'] = $role;
|
|
|
|
|
2024-06-13 18:05:32 +02:00
|
|
|
header('Location: ../index.php');
|
2024-06-11 11:27:58 +02:00
|
|
|
exit();
|
|
|
|
}
|
2024-06-10 19:29:21 +02:00
|
|
|
|
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
} else {
|
2024-06-15 17:47:50 +02:00
|
|
|
$error_verif2 = "Mot de passe incorrect";
|
2024-06-11 11:27:58 +02:00
|
|
|
}
|
2024-06-10 19:29:21 +02:00
|
|
|
} else {
|
2024-06-15 17:47:50 +02:00
|
|
|
$error_verif = "Ce login n'existe pas";
|
2024-06-10 19:29:21 +02:00
|
|
|
}
|
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Récupération des données du formulaire
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<header>
|
2024-06-14 18:42:40 +02:00
|
|
|
<h1 class='Hello'> Page de connexion </h1>
|
2024-06-11 11:27:58 +02:00
|
|
|
<nav>
|
2024-06-15 17:47:50 +02:00
|
|
|
<a href="../" class="categorie">Page d'accueil</a>
|
2024-06-11 11:27:58 +02:00
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
|
2024-06-14 18:42:40 +02:00
|
|
|
<div class="connexion">
|
2024-06-13 20:43:08 +02:00
|
|
|
|
2024-06-14 18:42:40 +02:00
|
|
|
<u><i><h2>Connexion</h2></i></u><br>
|
2024-06-11 11:27:58 +02:00
|
|
|
|
|
|
|
<form action="" method="post">
|
|
|
|
<label for="login">Login :</label><br>
|
2024-06-13 18:05:32 +02:00
|
|
|
<input type="text" id="login" name="login" required value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
|
2024-06-14 18:42:40 +02:00
|
|
|
<?php if (isset($error_verif)) {echo "<div class='error-message'>$error_verif</div>";} ?>
|
|
|
|
<br><br><label for="password">Mot de passe :</label><br>
|
|
|
|
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_REQUEST['password'])) { echo $_REQUEST['password']; } ?>"><br>
|
|
|
|
<?php if (isset($error_verif2)) {echo "<div class='error-message'>$error_verif2</div>";} ?>
|
|
|
|
<br><br><button type="submit" class="submit">Se connecter </button>
|
|
|
|
</form>
|
|
|
|
<p class="compteUser">Vous ne possédez pas de compte ? <br><a href="inscription.php">Inscrivez-vous !</a></p>
|
2024-06-10 19:29:21 +02:00
|
|
|
|
2024-06-13 20:17:56 +02:00
|
|
|
</div>
|
|
|
|
|
2024-06-13 19:50:01 +02:00
|
|
|
|
|
|
|
<footer>
|
2024-06-14 18:42:40 +02:00
|
|
|
<?php require_once('footer.php'); ?>
|
2024-06-13 19:50:01 +02:00
|
|
|
</footer>
|
|
|
|
|
2024-06-14 18:42:40 +02:00
|
|
|
|
2024-06-11 11:27:58 +02:00
|
|
|
</body>
|
|
|
|
</html>
|