Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Edit online: problem with Apple / Safari

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is a way to lock a file while accessing it in PHP. If two people did try to edit at the same time, one would simply fail.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Thanks John. Do you know how to do that? If not, I'll google around.

  3. #13
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In PHP 5+ if using the the file_put_contents function (combines file handle, file open and write from previous versions) to write to the file, you can use the LOCK_EX flag to prevent any other attempts at writing to the file during the operation. See:

    http://php.net/manual/en/function.file-put-contents.php

    Just opening and writing to a file is more complex in PHP 4, but I believe a similar thing can be done during the write phase.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. The Following User Says Thank You to jscheuer1 For This Useful Post:

    molendijk (09-16-2014)

  5. #14
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Thank you so much, John! I'm indeed using file_put_contents.

Similar Threads

  1. Resolved PHP coding for online form problem
    By kimikai in forum PHP
    Replies: 0
    Last Post: 03-09-2014, 09:30 PM
  2. Replies: 53
    Last Post: 01-26-2011, 08:14 PM
  3. Dynamic Ajax Content on Apple Safari
    By jamesglondon in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 12-03-2008, 04:42 PM
  4. Problem with Apple style accordian menu
    By ctworion in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 11-17-2008, 08:04 PM
  5. Redirecting Apple's Safari
    By Cletus in forum JavaScript
    Replies: 3
    Last Post: 03-20-2006, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •