Announcement

Collapse
No announcement yet.

Correct usage of flock?

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

  • 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, 1:29pm.
    Five Star Review Script - Add reviews to your website!
    Mixed Martial Arts - Houston MMA Training
    Women's Self-Defense - Courses and DVDs available

  • #2
    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
    Five Star Review Script - Add reviews to your website!
    Mixed Martial Arts - Houston MMA Training
    Women's Self-Defense - Courses and DVDs available

    Comment


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

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X