i'm having a problem with my connexion.php Even when I enter something in input my connexion.php tell me to insert something. I don't know where's the error...
My inputs :
input type="text" class="form-control" id="identifiant" required data-validation-required-message="Entrer un identifiant."
input type="password" class="form-control" id="mdp" required data-validation-required-message="Entrer un mot de passe."
Here is my php :
<?php
$db = mysql_connect('localhost', 'root', 'root');
mysql_select_db('Projet',$db);
if(empty($_POST['identifiant']) && empty($_POST['mdp'])) {
echo "Il manque des informations veuillez remplir les champs.";
}
else{
$_POST['mdp'] = hash("md5", $_POST['mdp']);
extract($_POST);
$sql = "select Password from User where Username='".$identifiant."'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_assoc($req);
if($data['Password'] != $mdp) {
echo '<div class="alert alert-dismissable alert-danger">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong>Oh Non !</strong> Mauvais login / password. Merci de recommencer !
</div>';
}
else {
session_start();
$_SESSION['Username'] = $identifiant;
echo '<div class="alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Yes !</strong> Vous etes bien logué, Redirection dans 5 secondes ! <meta http-equiv="refresh" content="5; URL=dashboard">
</div>';
}
}
?>