I have browsed around the forums and found quite a few people asking the same question with the same problem I have (just time differences) but no answer.
My problem is the session is expiering after 30 minutes of inactivity. After reading a few other post I have come to the conclusion that the time a session expires is determined by the PHP settings which I do not think I have access to because I am on a shared webhost provider (Maybe I can access them but how?).
I saw about 5 post where $_SESSION() is explained but nowhere on how to prevent the session from expiring.
How do I make it so the session will ONLY expire when the browser is closed or expire after a specified time? I am trying to avoid cookies on the client side.
I am using PHP 4.2
Here is the code I am using to test the sessions, I documented it so others just looking to setup a session can use it:
My problem is the session is expiering after 30 minutes of inactivity. After reading a few other post I have come to the conclusion that the time a session expires is determined by the PHP settings which I do not think I have access to because I am on a shared webhost provider (Maybe I can access them but how?).
I saw about 5 post where $_SESSION() is explained but nowhere on how to prevent the session from expiring.
How do I make it so the session will ONLY expire when the browser is closed or expire after a specified time? I am trying to avoid cookies on the client side.
I am using PHP 4.2
Here is the code I am using to test the sessions, I documented it so others just looking to setup a session can use it:
Code:
<?php
session_start(); // Start the session
// The below if statement checks if the variable 'count' is "registered" so it knows
// if it needs to continue or open a new session.
if (!session_is_registered('count'))
{ // If there is no current session
session_register('count'); // register the variable 'count' as a global session value
session_register('sid'); // register the variable 'sid' as a global session value
$sid = session_id(); // make the global variable $sid = the current session ID
$count = 1; // Make the global variable $count = 1
}
else
{ // if the session allready exist
$count++; // incriment $count + 1
}
// print some HTML
print <<<this
<p>Hello visitor, you have seen this page $count times.</p>
<p>To continue, <a href="_test.php?sid=$sid">click here</a>.</p>
this;
?>