2) { $count = 0; } // open the log file for writing, ensuring that it has been locked for // writing before doing so. // note that if the file does not already exist, an attempt will be made to create it! $file = fopen($logpath, 'w'); // the 'w' indicates writing mode if (flock($file, LOCK_EX)) { // do an exclusive lock fwrite($file, $count); // write out the updated count flock($file, LOCK_UN); // release the lock } fclose($file); return $page; } ?>