shadiadiph Posted February 27, 2009 Share Posted February 27, 2009 are there any functions in php that can be used for a session for example if a session is idle for 5 minutes start a countdown timer say 20 seconds displaying starting at 20 down to 0 then when hits 0 destroys the session. Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/ Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 to get something to dynamically countdown on their page, you will need javascript. my suggestion would be to use javascript to countdown, then if no action is taken, redirect them to the logout page Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772617 Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Author Share Posted February 27, 2009 mm ok in that case i will not bother i hate using javascript lol I avoid it like the plague. is there a session destroy function i can use if the user is idle for 5 minutes? Â Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772621 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772626 Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Author Share Posted February 27, 2009 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. Â Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772633 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772638 Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Author Share Posted February 27, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772643 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 http://devzone.zend.com/node/view/id/646 Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772646 Share on other sites More sharing options...
shadiadiph Posted February 27, 2009 Author Share Posted February 27, 2009 thanks rhodesa Quote Link to comment https://forums.phpfreaks.com/topic/147177-solved-count-down-to-0/#findComment-772655 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.