0

I searched a lot but didn't find any solution for my problem. I have a php live auction site where each product is unique. Once user added to the cart then it will be blocked and giving time limit to buy the product. If he fails to buy the product within time, then the product will be released again.

Now if a user closes the browser after adding to the cart, how do I delete the session variables?

I used onbeforeload and onunload, but that didn't solve the problem. This problem can not be solved by How to change the session timeout in PHP?.

Community
  • 1
  • 1
  • You can (sometimes) make the browser discard the session cookie, however there is absolutely no ***reliable*** way to discard a server-side session data store as soon as the user closes the window. You should rethink your approach. – deceze Mar 15 '16 at 12:57
  • Thank you.. can you tell me some of the other ways to deal with my problem... – Sudhir Koimattur Mar 15 '16 at 13:01
  • 1
    Keep track of the last time a user was seen (on every page load, update a timestamp), discard sessions/baskets of users which weren't seen within the last X minutes. – deceze Mar 15 '16 at 13:03
  • Thank you... Will try to implement in that way... Thanks again – Sudhir Koimattur Mar 15 '16 at 13:10

0 Answers0