Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.