Keeping A Session Alive

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Keeping A Session Alive

Post by tecktalkcm0391 »

Is there a way to keep a session alive under this condition:

Say the user is on the site and they get up and they are still on the site's page, but haven't refreshed it or moved anywhere else, so there session expires and then they get logged out. But I want them to stay logged in as log as they have a page opened in the browser. Is this possible? How would I do it?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

change your garbage collection routine to run less often and/or set the cookie to expire farther out (or like a standard session)
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I've see Javascript on pages that seem to keep the session alive is that possible?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Yes, but you need to be careful as Javascript isn't guaranteed to run.
Post Reply