J
Joakim Braun
Unonload doesn't get much time when quitting the browser. So how can you
do time-consuming actions then?
I'm doing a web-based MySQL interface. Records are presented as tables of
links. The problem is check-in/check-out: Who can change which record when?
So far I have a "session" approach: on login, user gets a session ID valid
for some amount of time. Editable records have a database column for storing
session ID:s. When user tries to open a record, we check its session ID
column for unexpired sessions. If there are none, user gets an editable
document that he can save back to the database, and user's session ID gets
written to the column. If there's an unexpired session going on with the
record, user gets a non-editable document with a "document busy" message.
When user closes editable document, user's session ID gets cleared from the
database record by loading a PHP page. This is triggered by the onunload
event.
This obviously wont work in case of crashes. It also doesn't work if user
quits browser application: The unonload doesn't get enough time then to load
the PHP page.
Ideas? Design comments? (sessioning is ugly, but how else can a
browser/database interaction be handled?)
Joakim Braun
do time-consuming actions then?
I'm doing a web-based MySQL interface. Records are presented as tables of
links. The problem is check-in/check-out: Who can change which record when?
So far I have a "session" approach: on login, user gets a session ID valid
for some amount of time. Editable records have a database column for storing
session ID:s. When user tries to open a record, we check its session ID
column for unexpired sessions. If there are none, user gets an editable
document that he can save back to the database, and user's session ID gets
written to the column. If there's an unexpired session going on with the
record, user gets a non-editable document with a "document busy" message.
When user closes editable document, user's session ID gets cleared from the
database record by loading a PHP page. This is triggered by the onunload
event.
This obviously wont work in case of crashes. It also doesn't work if user
quits browser application: The unonload doesn't get enough time then to load
the PHP page.
Ideas? Design comments? (sessioning is ugly, but how else can a
browser/database interaction be handled?)
Joakim Braun