Re: DB access and sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since you can't be sure to be notified when a user stops editing a
page, whatever solution you choose will probably involve some sort of
timeout-based system.  (e.g. when someone starts editing a page, set a
"last_opened" time field on the resources, and when someone else tries
to edit the same page, check to see if "last opened" is in the last 30
mins).  If you combine this with an ajax/iframe reload, you can be
much more precise (e.g. while someone is editing a document, have
their browser hit a designated url every 60 seconds; when the repeated
hits stop, you know they're done)

Since no such system is absolutely positively foolproof, you'll
probably want to look into optimistic locking if you want to guarantee
that  no one's changes are accidentally overwritten.

Tyler


On 8/17/05, Bret Walker <bret-walker@xxxxxxxxxxxxxxxx> wrote:
> Hello-
> 
> I'm developing a web-based system whereby users can edit documents and
> then e-mail the documents to selected recipients.
> 
> The "documents" are comprised of the data from several MySQL fields.
> 
> I want to make sure that two people don't edit a document at the same time.
> 
> My users log in via a script that starts a session.
> 
> My initial idea was to have a field to denote file access (1 for "in
> use" 0 for available).  The problem with this would be if a user
> navigates to a different page or closes the browser window without
> clicking a "save" or "close" button (which would execute a query to set
> the in_use field to 0).
> 
> I'm sure others have dealt with the issue of exclusive access to a MySQL
> resource.  I've looked into InnoDB transactional support, but that
> doesn't seem to be what I need, since I'm not overly concerned about
> simultaneously access, just simultaneous editing.
> 
> How can I ensure the "document" isn't accessed by two people at the same
> time?
> 
> Thanks,
> Bret
> 
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux