I believe the syntax is correct but how would I test to see if the txt file is indeed being locked and unlocked after being written to?
$fp = fopen($settings['idfile'],"wb") or die("Can't open the id file ($settings[idfile]) for reading!");
flock( $fp, LOCK_EX );
fputs($fp,$previd);
flock( $fp, LOCK_UN );
fclose($fp);