Announcement

Collapse
No announcement yet.

Correct usage of flock?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mark Hensler
    replied
    The @ sign before @flock (I believe) suppresses errors.
    That's all I know. I've never used flock.

    Leave a comment:


  • Tim Mousel
    replied
    From what I can tell, this is the correct usage:

    PHP Code:
    $fp = @fopen($password_file"a+") or die("Cound not open $password_file for read/write access.");
    @
    flock($fpLOCK_SH LOCK_NB) or die("Cannot Lock");
    fwrite($fp$userpass);
    fclose($fp); 
    It doesn't create any errors so I'm assuming it's correct. Please correct me if I'm wrong.


    Tim

    Leave a comment:


  • Tim Mousel
    started a topic Correct usage of flock?

    Correct usage of flock?

    PHP Code:
    $newfile fopen($password_file"a+");
    flock($newfile2) or die("Cannot Lock");
    fwrite($newfile$userpass);
    fclose($newfile);
    flock($newfile3) or die("Cannot Release Lock"); 
    Is that the correct usage of flock?

    Thanks.
    Last edited by Tim Mousel; Tue 12 Jun '01, 2:29pm.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X