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
| <html>
<body>
<img src="Sans titre-2.jpg">
<form action="index.php" method="POST">
<p>
Username
<input name="user" type="text" value="<?php echo $_COOKIE["login"]; ?>" >
Password
<input type="password" name="pwd">
<input name="Submit" type="submit" value="OK">
Auto Connection
<input name="cookies" type="checkbox" value="1">
<a href="inscription.php">vous n'etes pas membre</a></p>
<hr >
</form>
<a href="liste.php">listes de livres</a>
<p>
<?php
if(isset($_POST["Submit"])&&$_POST["user"]!=" "&&$_POST["pwd"]!="")
{$username=$_POST["user"];
$password=$_POST["pwd"];
mysql_connect('localhost','root','');
mysql_select_db('compte');
$req=mysql_query("select * from utilisateur where username='$username'
and password='$password'");
if(mysql_num_rows($req)!=0)
{session_start();
$_SESSION["username"]=$username;
header("location:main.php");}
else
{echo "login incorrect";}
if(isset($_POST["cookies"])&&$_POST["cookies"]=="1")
{setcookie("login",$username);}
else{setcookie("login");}
?>
</body>
</html> |
Partager