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
Standard PHP sessions are stored in files. You could implement a simple shell script to find any session file which hasn't been touched in 10 minutes:
find /path/to/session/dir/* -mmin -10
grep can be used to find the session files which have a final_ticket_book='N' value stored in them:
grep -l 's:17:"final_ticket_book";s:1:"N";'
(the -l flags has grep spit out the names of the files which match).
Combining the two gives you:
find /path/to/session/dir -mmin -10|xargs grep -l 's:17:"final_ticket_book";s:1:"N";'|xargs rm -f