here is the full script, thought it would be easier to post the lines were i thought the error was, thanks for the quick response :@)
<?php
if (!empty($_SERVER['HTTPS'])=="" or $_SERVER['HTTPS']=="off") {
$url_page_to_count = "";
} else {
$url_page_to_count = "";
}
$url_page_to_count = $url_page_to_count . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
$allLines = file(".htCounter.csv");
while($line=array_pop($allLines)) {
list($url,$count) = split(":" $line);
$count = rtrim($count);
$counts[$url] = $count;
}
if ($counts[$url_page_to_count] > 0) {
$counts[$url_page_to_count]++;
$fh = fopen(".htCounter.csv", "w");
if (flock($fh, LOCK_EX)) {
foreach ($counts as $url=>$count) {
fwrite($fh, "$url,$count\n");
}
flock($fh, LOCK_UN);
}
fclose($fh);
$count = $counts[$url_page_to_count];
} else {
$fh = fopen(".htCounter.csv", "a");
if (flock($fh, LOCK_EX)) {
fwrite($fh, "$url_page_to_count,1\n");
flock($fh, LOCK_UN);
}
fclose($fh);
$count=1;
}
?>
|