I am building a online ticket booking site . In this I am doing the following things : The user searches the bus with their seat numbers . The database is updated with the seat numbers with temp_seat_book = 'Y' . If he books the ticket paying money his status will be updated to final_ticket_book = 'Y' . Now I want to delete the field whose temp_seat_book = 'Y' but
final_ticket_book = 'N' . For this I need to delete the session_ids which is more than 10minutes old and final_ticket_book = 'N'. So how I can implement the background job?
I am building a online ticket booking site . In this I am doing
Share
Instead of doing a search for files (which involves more i/o ) etc,
What is a session cookie: Session Cookie
A better way is to store a time stamp of the ‘most recent activity’ in the $_SESSION variable.
And updating the session data on every request (including the automated periodic ajax calls if any).
Lets say you want to unset the session after 10 minutes,
Also, make sure
session.gc-maxlifetimeis set to the maximum expire time you want to use.You can do this
Or
Set it directly in your php.ini.
and also
session.cookie_lifetime :
Although this method is a tad tedious, Its more elegant.
Ah, found the link which I had read a long time ago! : How do I expire a PHP session after 30 minutes?