$rfile[0]) { // if this referrer is different from the last one if (count($rfile) == $maxref) // if the file is full array_pop($rfile); // pop the last element $refsep = implode("|", $refarray); // put separator between info array_unshift($rfile, $refsep); // push the new referrer onto the front $r = join("", $rfile); // make the array into a string $rp = fopen($reflog, "w"); // open the referrer log in write mode $status = fwrite($rp, $r); // write out the referrer URLs $status = fclose($rp); // close the log } } $status = fclose($sp); // close the semaphore (and release the lock) } ?>