forked from ghouar-t/SaeDEV2.2
93 lines
2.5 KiB
PHP
93 lines
2.5 KiB
PHP
<html lang="fr">
|
|
<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>
|
|
|
|
|
|
<?php
|
|
|
|
// Informations de connexion à la base de données
|
|
require_once 'common.php';
|
|
session_start();
|
|
if (!empty($_REQUEST['login']) && !empty($_REQUEST['password'])) {
|
|
$db = initDatabase();
|
|
$login = $_POST['login'];
|
|
$password = $_POST['password'];
|
|
|
|
|
|
$result=mysqli_query($db,"SELECT * FROM user WHERE login = '$login' ");
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
|
|
$row = mysqli_fetch_assoc($result);
|
|
$hash = $row['mdp'];
|
|
|
|
|
|
if (password_verify($password, $hash)) {
|
|
if ($login) {
|
|
$_SESSION['login'] = $login;
|
|
header('Location: ../index.php');
|
|
exit();
|
|
}
|
|
|
|
|
|
} else {
|
|
echo "Échec de la connexion : couple login/mot de passe invalide.";
|
|
}
|
|
} else {
|
|
echo "Échec de la connexion : login inconnu.";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// Récupération des données du formulaire
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div id="content_cours">
|
|
|
|
<header>
|
|
<nav>
|
|
<a href="../index.php" class="categorie">Page d'accueil</a>
|
|
</nav>
|
|
</header>
|
|
|
|
|
|
<h2>Connexion</h2><br>
|
|
|
|
<form action="" method="post">
|
|
<label for="login">Login :</label><br>
|
|
<input type="text" id="login" name="login" required value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
|
|
<label for="password">Mot de passe :</label><br>
|
|
<input type="password" id="password" name="password" required placeholder="••••••••" value="<?php if (isset($_REQUEST['login'])) { echo $_REQUEST['login']; } ?>"><br>
|
|
|
|
<input type="submit" value="Se connecter">
|
|
</form>
|
|
|
|
|
|
<footer>
|
|
<div class="licence">
|
|
<p>Ces ressources sont publiées sous licence Creative Commons Attribution</p>
|
|
<a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">
|
|
<img alt="Licence CC Attribution" src="../img/cc.png">
|
|
</a>
|
|
<p>
|
|
<strong>Site SAE 2.2 réalisé par : </strong>
|
|
<a href="mailto:rafael.ghouar-toussaint@etu.u-pec.fr">Rafaël Ghouar-Toussaint</a> -
|
|
<a href="mailto:alexis.hadjem-brancher@etu.u-pec.fr">Alexis Hadjem-Brancher</a> -
|
|
<a href="mailto:nicolas1.laurent@etu.u-pec.fr">Nicolas Laurent</a>
|
|
</p><br>
|
|
</div>
|
|
</footer>
|
|
|
|
</body>
|
|
</html>
|