RTS Posted October 3, 2006 Share Posted October 3, 2006 Is there a way to have a database automatically be updated when the session times out? Quote Link to comment Share on other sites More sharing options...
MCP Posted October 3, 2006 Share Posted October 3, 2006 yes, but you'll have to write your own session handling functions for all session related options. Seehttp://ca.php.net/manual/en/function.session-set-save-handler.phpThere's even an example there for file-based sessions which you might want to extend. You'll want to put your database update in the _close and/or _gc functions. Quote Link to comment Share on other sites More sharing options...
RTS Posted October 5, 2006 Author Share Posted October 5, 2006 well, I realized there is a problem with doing that on my site, so I have another question. Is there a way to update the database when a user leaves the site? that would work better. Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 not without javascript. The only action is when a php script is called. Quote Link to comment Share on other sites More sharing options...
RTS Posted October 5, 2006 Author Share Posted October 5, 2006 hmmmmm... could someone explain how to do what was suggested first? the tutorial confused me, and I didnt get what I was supposed to do... Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I've never done this before, but it looks like you define functions with the same names as these:session_set_save_handler("open", "close", "read", "write", "destroy", "gc");Then when named action occurs, it runs that function. You would have to include this file on all of your pages, likely before you do session_start(); 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.