我的connexion.php出了问题 即使我在输入中输入内容我的connexion.php告诉我插入一些东西。 我不知道错误在哪里......
我的意见:
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."
这是我的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>';
}
}
&GT;
答案 0 :(得分:2)
您需要在输入标记中添加"name"
属性..
<input type="text" class="form-control" id="identifiant" name="identifiant" required data-validation-required-message="Entrer un identifiant." />
<input type="password" class="form-control" id="mdp" name="mdp" required data-validation-required-message="Entrer un mot de passe." />