ok maybe my script was a bad exemple ..
here is what i try to do (and that fails with my webhost ) :
A session based authentification system :
first page :
login.php :
session_start();
if (isset($_SESSION) && sizeof($_SESSION)>0)
{
session_unset(); // session_destroy
}
function Identify($login,$mdp)
{
global $sess_id, $link, $PHPSESSID, $_SESSION, $HTTP_SESSION_VARS;
//... DATABASE request ... it's matching then :
$sess_id=$var->id;
session_register("sess_id");
/*
note :
i've ttried this too :
$HTTP_SESSION_VARS["sess_id"]=$sess_id;
or $_SESSION["sess_id"]=$sess_id;
*/
header("Location: index.php?PHPSESSID=".$PHPSESSID);
exit();
}
// When the form is posted :
if (isset($login) && Trim($login)!="" && isset($mdp) && Trim($mdp)!="")
{
Identify($login, $mdp);
}
and finally of course the HTML form with method = POST and action = login.php ang html input login & mdp...
Second page :
index.php
session_start();
if (!isset($_SESSION['sess_id']))
{
header("location: login.php");
}
include "page1.php";
include "page2.php";
....
In my index.php are included all the files i display...
So each time i made a form or url link, i pass the PHPSESSID value and the session is recognized and go on working.
But sometimes it dont ! Exemple, if i do some refresh on a page that has been recognized, it work and in a while (never the same time ) it fails.
I dont get a damm why ?? it's like the session was destroyed in index.php sometimes and sometimes not ?
Anyone could explain me why ?? or is it my structure that is bad ? Moreover as this always work on my local server i though it was fine .....
Thx for help because i'm stuck on this for a long time ....