http://$SERVER_NAME$PHP_SELF?target.php"); $file_arry = file($COUNT_FILE) or error("Can not open \$COUNTFILE ('$COUNTFILE')"); while (list($key, $val) = each($file_arry)) { if ($val != "") { list($file_url, $nb) = preg_split("/\t|\n/", $val); if ($file_url == $url) { $nb++; $file_arry[$key] = "$file_url\t$nb\n"; $find = 1; } } } $file = join ("", $file_arry); if (! $find) $file .= "$url\t1\n"; $fp = fopen("$COUNT_FILE", "w") or error("Can not open \$COUNTFILE ('$COUNTFILE')"); flock($fp, 1); fputs($fp, $file); flock($fp, 3); fclose($fp); header("Location: $url"); ?>