gc is unreliable, servers seem to be creative too often
standard is to set a timestamp at login
compare with your timeout
if it hasn't timed out then refresh the timestamp
shouldn't this
$session_life = time() - $_SESSION['start'];
be
$session_life = time() - $_SESSION['timeout'];
I don't use the cookie as the timer as that is then stored on the user side, I know there is always a cookie but it only contains a session id, no data
>> sessions last for 25 mins by default
it's a server setting so it can be anything but the most common is 30 mins
>> even though isset() and empty() are the same
ah but they are not. isset checks that a var exists within scope and is not NULL.
empty on the other hand checks to see if the var has a value of empty, there are a few things that are considered empty. some comparisons to isset on the page as well
[
php.net...]
I usually do checks for isset and not empty and of the appropriate type when check existence of session vars and I check all standard session elements.