On Friday 16 January 2004 04:49, Lowell Allen wrote: > I need to implement database record locking and unlocking. I want to > prevent multiple users of a content management system from editing the same > record simultaneously, which can result in one user's edits being > overwritten. I can use PHP to lock a record when it's opened, and unlock it > when it's updated or if the user goes anywhere else within the content > management system (or logs out), but I need to account for a user leaving > the CMS directly from the edit screen. I'm not aware of any way to do that > other than using a Javascript onunload event to open a new window, run a > PHP script, and close the new window onload -- very nasty and unreliable > with pop-up blocking so popular. Can anyone suggest an all-PHP way?
There is no way to determine whether/when a user 'leaves' the edit screen. The best you can do is to set a timeout on the locked record. So if the person who locked the record hasn't done anything to it for the last 10 minutes (or whatever) then unlock the record. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* A psychiatrist is a fellow who asks you a lot of expensive questions your wife asks you for nothing. -- Joey Adams */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php