|
Posted by zorro on 06/13/06 15:25
Greetings,
I want users to select the duration time of their sessions. I'm able to
do it by setting the PHPSESSID cookie duration. Is this reliable, or is
it not recommended for some reason?
This is the test :
open browser, close browser, reopen browser
if( ! $_COOKIE["PHPSESSID"]) // opened browser first time - no session
{
// create a session
session_start();
// modify cookie duration
myCookieAdd("PHPSESSID",session_id(), $userSelectedNbHours);
// set some variable
$_SESSION["bozo"]='clown';
}
else // reopened browser - cookie still exists, variable still exists
{
session_start();
echo $_SESSION["bozo"]; // prints "clown"
}
any thoughts?
Navigation:
[Reply to this message]
|