37 lines
805 B
PHP
37 lines
805 B
PHP
|
<?php
|
||
|
|
||
|
// Informations de connexion à la base de données
|
||
|
$db = mysqli_connect("dwarves.iut-fbleau.fr","ghouar-t","Bases2023","ghouar-t");
|
||
|
if(!$db){
|
||
|
die("Connexion BD impossible.");
|
||
|
}else{
|
||
|
echo "Connexion BD reussie ! <br>";
|
||
|
}
|
||
|
|
||
|
// Récupération des données du formulaire
|
||
|
$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)) {
|
||
|
echo "Connexion réussie au mdp !";
|
||
|
|
||
|
|
||
|
} else {
|
||
|
echo "Échec de la connexion : couple login/mot de passe invalide.";
|
||
|
}
|
||
|
} else {
|
||
|
echo "Échec de la connexion : login invalide.";
|
||
|
}
|
||
|
|
||
|
mysqli_close($db);
|
||
|
|
||
|
?>
|