Forum Moderators: coopster

Message Too Old, No Replies

session passed in url occasionally expires

problems with session timing out?

         

RobOgden

9:04 am on Jan 8, 2005 (gmt 0)

10+ Year Member



I wondered if anyone could help me!
I use sessions without cookies, passed in the URL on a jobs website that I run. The important code at the top of each session-protected page is:

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

coopster

6:29 pm on Jan 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




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]

RobOgden

7:57 am on Jan 11, 2005 (gmt 0)

10+ Year Member



Dear Coopster,

Sorry about the delay. Thanks for the advice. Will change it in php.ini, as have virtual private server.

Thanks again,

rob