index.php
<?php session_start();
$host = "localhost";
$user = "root";
$pass = "";
$bdd = "mydb";
$link = mysql_connect($host,$user,$pass) or die("incorrect user or pass");
mysql_select_db("$bdd", $link) or die("Impossible to connect to DB");
$request = " SELECT * FROM USERS WHERE Username= '$login' AND Password= '$password' ";
$result = mysql_query($request,$link) or die(mysql_error());
if ($row = mysql_fetch_array($result)) {
session_start();
$login = $row["Username"];
$password = $row["password"];
$_SESSION['login'] = $login;
$_SESSION['pass'] = $password;
header("Location: page2.php");
exit();
}
?>
page2.php
<?php session_start();
Echo $login;
Echo $_SESSION('login');
if($login==null || $login=='' || $password==null || $password=='' || !isset($_session('login')) || !isset($_session('password')) )
{
header("location:index.php");
}
else {
Echo $login;
Echo $_session('login');
}
?>
Lors de la saisie du user et passe, la page retourne toujours vers la page index.php.
Si je supprime le test de verification du login et passe à null, vide et isset session, la page page2.php s'affiche blanche vide malgré qu'il y a echo $login et echo $password !!!
voilà en résumé,
thnx.
@ -:)
Zebra