In home.php, (since index.php is a portal), I do session_start() on line 1, like it should. Then at some point on the page, I do include("include/ad+menu.php"), here is ad+menu.php :
CODE
// Here is a google ad...
<div id=menu>
<?php if($_SESSION['name'] != NULL) { ?> // If i am logged in
<div id=session class=menu_element>
Connecté en tant que : <div id=session_name><?php echo $_SESSION['name']; ?></div>
<a href="session/end.php" class=connect>Déconnexion</a>
</div><?php }
else {?> // If I am not logged in
<a href="session/login.php" class=connect>Connexion</a> <?php } ?>
// Then I have some links...
</div>
<div id=menu>
<?php if($_SESSION['name'] != NULL) { ?> // If i am logged in
<div id=session class=menu_element>
Connecté en tant que : <div id=session_name><?php echo $_SESSION['name']; ?></div>
<a href="session/end.php" class=connect>Déconnexion</a>
</div><?php }
else {?> // If I am not logged in
<a href="session/login.php" class=connect>Connexion</a> <?php } ?>
// Then I have some links...
</div>
On session/login.php, I have a form that sends "username" and "password" by POST to postlogin.php Then I have postlogin.php
CODE
<?php session_start();
$password = crypt($_POST['password'], pl);
$username = $_POST['username'];
mysql_connect("localhost", "plgod_clanteam_com_admin", "nothing");
mysql_select_db("plgod_clanteam_com_main");
$response = mysql_query("SELECT * FROM session WHERE username ='$username' AND password ='$password'");
$data = mysql_fetch_array($response);
mysql_close();
if($data['name'] == NULL) // I received nothing, so incorrect user or pass
{
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Erreur</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Main Style" href="../styles/main_style.css" />
</head>
<body>
Le nom d'utilisateur ou le mot de passe est incorrect. Ou peut-être que vous n'êtes pas inscrit. <a href="login.php">Rééssayer</a> ou <a href="../home.php">retour à l'accueil</a>? // Means incorrect username or pass, you guessed it.
</body>
</html>
<?php die();
}
// I received something, so Ive got a user
$_SESSION = $data; // Setting up all data at once.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Connexion OK</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Main Style" href="../styles/main_style.css" />
</head>
<body>
// Everythings fine, welcome, bla bla bla, I even show $_SESSION['name'] and it is ok, same as in the database (different from $username)
</body>
</html>
$password = crypt($_POST['password'], pl);
$username = $_POST['username'];
mysql_connect("localhost", "plgod_clanteam_com_admin", "nothing");
mysql_select_db("plgod_clanteam_com_main");
$response = mysql_query("SELECT * FROM session WHERE username ='$username' AND password ='$password'");
$data = mysql_fetch_array($response);
mysql_close();
if($data['name'] == NULL) // I received nothing, so incorrect user or pass
{
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Erreur</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Main Style" href="../styles/main_style.css" />
</head>
<body>
Le nom d'utilisateur ou le mot de passe est incorrect. Ou peut-être que vous n'êtes pas inscrit. <a href="login.php">Rééssayer</a> ou <a href="../home.php">retour à l'accueil</a>? // Means incorrect username or pass, you guessed it.
</body>
</html>
<?php die();
}
// I received something, so Ive got a user
$_SESSION = $data; // Setting up all data at once.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Connexion OK</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Main Style" href="../styles/main_style.css" />
</head>
<body>
// Everythings fine, welcome, bla bla bla, I even show $_SESSION['name'] and it is ok, same as in the database (different from $username)
</body>
</html>
But then I come back to home.php and ad+menu still shows the "connexion" link, whereas it should put a "déconnexion" link. It does so on my local server, but it doesn't on zymic. Are session disabled? Please help me.