Forum Moderators: coopster
session_name ('YourVisitID');
session_start();
if (!isset($_SESSION['e_first_name'])) {
header ('Location: ***(my site address home page***');
ob_end_clean();
exit();
} else {
Rest of the script
}
The session ID has been manually appended to all urls (session_trans_id is off) and it works fine 99% of the time. session.cookie_lifetime is set to 0.
Occasionally, a visitor finds that they are redirected to the homepage in the middle of a session and lose all the work they have done. It appears to be timing out, or could simply be an occasional glitch.
Does session.gc_maxlifetime have relevance with sessions passed in the URL? If so, this could be the problem. It is set to 1440 seconds.
I would really appreciate any advice, as I don't want to lose job seekers!
Thanks,
Robert Ogden
Does session.gc_maxlifetime have relevance with sessions passed in the URL?
Yes. Garbage collection occurs on any and all sessions found in the path specified in the session.save_path [php.net] directive. You can override the timeout, but watch out if you are on a shared server as it is not going to be reliable. The following thread pertains to cookies, but the garbage collection routine applies to both scenarios.
Session is timing out - how do I increase cookie time? [webmasterworld.com]