Sessions - Set and Detect Timeout
Posted on 2008-10-24
I have my web application and i need to maintain sessions. I have a problem i dont understand how to do. My application has a search page where the user inserts his criiteria and then the search result is displayed. Once if the user likes any item in the search result, he cllick and he goes to booking form.
I need to know when the session expires. what if the user clicks the booking button and just stays idle on the booking form for 1 hour without any activity. How can i know that the session is expired.
Im all may pages im using session_start().
The reason Im asking to know that the session is expired is because, once the user likes any item in search result and clicks the book button, i deduct the item from the inventory temporarily and put it in the cart of the user till the payment is complete. Hence for this reason i need to know when the session has expired so that I can put the item back to the inventory. And in my application i want to session to be valid only for 15 mins. How can I do that?