Code Library - php
Hit Counter - (2186 views)
create a file and name it count.dat
CHMOD count.dat to 666
<?
//set the count file
$counterfile = "count.dat";
//check the file is readable
if(!($fp = fopen($counterfile,"r"))) die ("cannot open counter file");
//grab the value and increase by 1
$count = (int) fread($fp, 20);
fclose($fp);
$count++;
//show the result, write the new value and close the file
echo "Site Hits: $count";
$fp = fopen($counterfile, "w");
fwrite($fp , $count);
fclose($fp);
?>


