Code: Select all
<?
if($username && $password) {
mysql_connect("localhost","root","") or die ("Whoops");
$password = ($password);
$sql = "select * from utilisateurs where username='$username'";
$r = mysql_db_query("micmacs",$sql);
if(!mysql_num_rows($r))
header("Location: authentification.php");
$user = mysql_fetch_array($r);
if($userї"password"] == $password) {
$password = ($password);
setcookie("micmacs_login","$username $password");
$msg = "<meta http-equiv="Refresh" content="0;url=./soumettre.php">";
}else{
header("Location: authentification.php");
}
}
if ($msg) echo $msg;
?>Code: Select all
<?
if(!$_COOKIEї'micmacs_login'])
header("Location: authentification.php");
$known=$micmacs_login;
if($known) {
mysql_connect("localhost","root","") or die ("Whoops");
$user = explode("","$known");
$sql = "select * from utilisateurs where username='$userї0]'";
$r = mysql_db_query("micmacs",$sql);
if(!mysql_num_rows($r)) {
header("Location: authentification.php");
}
$chkusr = mysql_fetch_array($r);
if(($userї1]) != $chkusrї1])
header("Location: authentification.php");
}
?>