b1011 Posted July 17, 2007 Share Posted July 17, 2007 Hello. My website uses sessions for the login functions and then they expire after a while so then it basically logs you out. How can i get it so when they expire they execute some code, see i want to have an online users list and ill need to execute some mysql code when the session expires or they log-off. is this possible? if not, are there any alternatives? Quote Link to comment Share on other sites More sharing options...
drewbee Posted July 17, 2007 Share Posted July 17, 2007 You cannot execute time delayed PHP code if the page is already loaded. You have to either a) increase the session timeout b) create a custom session management system (I do this through db) c) You can keep every user logged in by making AJAX call to a PHP file every 10 minutes or so that contains session_start(). This will refresh the session. d) Force the users off of the page or let them know they are going to be logged out in x amount of minutes through javascript using setTimeout() Personally the db sessions work the best for me. Quote Link to comment 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.