probleme de boucle(il sort tjrs de la boucle)
Posté : 07 sept. 2010, 13:59
bonjour;
j'ai un probleme de boucle,quand j'entre les login et les mots de passe tout le temps m'affiche ""'Check your login and / or password'""
Bien cordialement
Kaoutar
j'ai un probleme de boucle,quand j'entre les login et les mots de passe tout le temps m'affiche ""'Check your login and / or password'""
<html>
<head>
<body bgcolor="#99ccff">
<a href="file:///C|/wamp/www/Flan/index.html"></a>
</body>
<?php
session_start();
echo "<center>";
$x=mysql_connect('localhost','root','');
mysql_select_db('application',$x);
$v1=$_POST['Login'];
$v2=$_POST['Password'];
$trouv=0;
$req="select * from authentification";
$res=mysql_query($req);
while($lig=mysql_fetch_array($res))
{
if($lig['Login']==$v1 && $lig['Password']==$v2 )
{ if( $lig ['statut']=='admin')
$trouv=1;
else if($lig ['statut']=='user')
$trouv=2;
else
$trouv=0;
}
}
if($trouv==1)
{
echo "<script >alert(\"Vous etes admin!\" );
</script> ";
header("location:index.php");
}
else if ($trouv==2)
{ echo "<script >alert(\"Vous etes user!\" );
</script> ";
header("location:index.php");
}
else{
//echo "<html>";
//echo "<head>";
echo "<script>";
echo "alert('Check your login and / or password')";
echo "</script>";
//echo "</head>";
//echo "</html>";
//echo "<b><font color=\"red\"> LOGIN OU MOT DE PASSE INCORRECT </font></b> <BR/><BR/>";
//header("location:index.html");
}
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=file:///C|/wamp/www/projet/index.html">
</head>
</html>
et je savais pas ou reside le probleme, et vu que je suis nouvelle a la programmation PHP n'hesitez pas de me repondre svp je serai amplement reconnaissante.Bien cordialement
Kaoutar