On Sat, March 19, 2005 6:48 am, John Taylor-Johnston said: > chmod($defaultfile, 666); http://php.net/chmod has examples that tell you exactly why this is wrong... 666 is decimal. The 666 you want is Octal. They ain't the same number. > What does the at_sign mean at the start of this line? > > @ $results = fopen($datafilename, "w+"); @ means you are IGNORING any errors this generates. It's usually a really bad idea unless you have some more code for error checking. > if (!$results) { die ("Our results file could not be opened for writing. > Your score was not recorded. Please contact the person responsible and > try again later."); } > flock($results, 2); #lock file for writing > fwrite($results, $filestr); #write $filestr to $results > flock($results, 3); #unlock file > fclose($results); #close file This is an incorrect way to try to flock a file for writing. You should: 1) Open the file for READING. 2) flock that file handle, so only YOU have access to that file. 3) Re-open the file for WRITING, now that you have control. 4) Write your data 5) Release the lock. Your application, as it stands now, has a race condition between the open for writing and the flock, which sooner or later, WILL bite you in the ass. Probably. Maybe. If $filestr is small enough, the Linux OS has locking built-in. Windows may or may not (and I don't care enough about Windows to remember, much less look it up). FreeBSD and other OSes may or may not also have locking at OS layer. I wouldn't rely on it, though, since it's trivial to do the 5 steps above. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php