http://$SERVER_NAME$PHP_SELF?target.php"); $file_arry = file($COUNTFILE);// or error("1 - 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("$COUNTFILE", "w") or error("2- Can not open \$COUNTFILE ('$COUNTFILE')"); flock($fp, 1); fputs($fp, $file); flock($fp, 3); fclose($fp); header("Location: $url"); ?>