Jump to content

[SOLVED] count down to 0


shadiadiph

Recommended Posts

you can always keep track of their latest activity in a SESSION variable, and when there is more activity confirm the value in the SESSION is less then 5 minutes ago. but it won't display anything on the frontend to tell them it's been 5 minutes.

thats no problem i just want it to log them out if they have been idle for 5 minutes.

 

here is another brain teaser on another site i am making when a user logs on it stores to a bale called logged to see which users are logged in. Problem is if the user just closes their browser like 90% of people do they are still registered as logged in the logged table how can i deal with this.

 

again, go with an activity timestamp. you'll need to decide on an amount of time until you consider the session dead (like 5 minutes). next, modify your SELECT statements to only retrieve entries from that table where the last activity is within the 5 minutes. finally, have a scheduled job that runs periodically (hourly or nightly or something else) and removes old entries

 

edit: actually, to avoid a scheduled job, just have it clean up entries on an often action (like logins) but a not to often action (like every page load). Logins are good, as it will probably slow the page load down a few miliseconds, but people already expect logins to take a hair longer then regular page loads.

thanks for the help I am still a bit confused about sessions just started using them but i understand just need if statement and update sql statement my prblem is i don't really understand sessions yet or how they work or what they are doing any tips on where I can read up on this i dont find the php manual too informative

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.