title: release a db lock when php session ends?
body: <p>Suppose a user is editing a record from a database,
  in the schema you have a field named 'lock' so users can not edit
  concurrently the same record, once the user ends editing you set
  lock = false to allow other users to edit the record.</p>
  
  <p>My question is, can i run some code when php session ends, so if a user
  walks away from computer, close the browser or whatever, i can set the lock to false?.
  Because if not, and correct me if I'm wrong, the record would remain locked?</p>
  
  <p>I've read the <code>session_set_save_handler</code> section from php manual, but i'm not sure that
  the 'close' callback it's what i need... </p>
  
  <p>Or do I need to add a timestamp in the db schema and run a cronjob to 'unlock' the records
  every x time?</p>
  
  <p>Thanks!</p>