Forum Moderators: coopster

Message Too Old, No Replies

PHP Session problem

         

andrewsmd

6:07 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a page that I use session variables on to keep outputted messages. How the basic layout of my page is something like this.
There is a checkbox and when the user clicks the checkbox I call a PHP file via JavaScript. The php file does some checks then returns an html message that is in JavaScript format so it can be added to the page in what seems like real time. I have to auto refresh this page every 5 minutes because the content also depends on other variables that continuously change. In addition I save this output to a text file and load it based on the username they log in with in case you go to a different computer and access this page it will load the same content.
Here is my problem. If you leave your browser open over night the session never fails because it is refreshed every 5 minutes. However, I would like to reload the original content the next day and not the content from the day before. Is there any way to make sessions time out after they are started and not re initialized or updated.

bkeep

7:21 pm on Jan 21, 2009 (gmt 0)

10+ Year Member



If you set a session start time then check if that $_session["start_time"] exists and if it does check the start time against the current time then if the difference is > 12 hours reset the session ?