login.php
1.16 KB
<?php
session_start();
if(isset($_POST['identifiant']) && isset($_POST['mdp'])){
include("connexion.php");
$identifiant = mysqli_real_escape_string($db,htmlspecialchars($_POST['identifiant']));
$mdp = mysqli_real_escape_string($db,htmlspecialchars($_POST['mdp']));
if($identifiant !=="" && $mdp !== ""){
$requete = "SELECT count(*) FROM utilisateur WHERE
login = '".$identifiant."' AND mdp = '".$mdp."' ";
$exec_requete = mysqli_query($db,$requete);
$reponse = mysqli_fetch_array($exec_requete);
$count = $reponse['count(*)'];
if($count!=0){
$_SESSION['identifiant'] = $identifiant;
echo "<meta http-equiv=\"refresh\" content=\"0;url=menu.php\">";
//header('Location : menu.php');
}else{
echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
//header('Location : index.html');
}
}else{
/* Ne devrait pas pouvoir arriver mais j'ajoute une double sécurité */
echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
//header('Location : index.html');
}
mysqli_close($db); // Fin de la connexion
}else{
//header('Location : /index.html');
echo "<meta http-equiv=\"refresh\" content=\"0;url=index.html\">";
}
?>