Besoins d'aide avec array
Salut a tous je suis débutant et j'ai un problème avec un array, je doit vérifier a l'aide d'un formulaire si l'usager a entrer le bon login et mot de passe mais rien ne fonctionne voici mon code
merci d'avance pour votre aide
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="no7.php">
<table width="300" border="1">
<tr>
<td width="140">Login</td>
<td width="144"><input name="login" type="text" id="login" /></td>
</tr>
<tr>
<td>Mot de passe</td>
<td><input name="password" type="text" id="password" /></td>
</tr>
<tr>
<td><input name="btnconnect" type="button" Value="Connecter" id="btnconnect" /></td>
</table>
</form>
<?php
$visiteur = array(
array("log1" => "pass1"),
array("log2" => "pass2"),
array("log3" => "pass3")
);
$user=$_POST['login'];
$pass=$_POST['password'];
if (isset($visiteur[$user]) and $visiteur[$user] == $pass)
{
echo 'connection reussis';
}
else{
echo 'echec';
}
?>
</body>
</html> |