try out this:
//hit_counter01, php
$counter,_file = "./count.dat";
if(!($fp = fopen($counter_file, "r"))) die ("Cannot open $counter_file.");
$counter = (int) fread($fp, 20);
fclose($fp);
$counter++;
echo "You're visitor No. $counter.";
$fp = fopen ($counter_file, "w");
fwrite ($fp, $counter);
fclose($fp);
?>
NB:at first you must create a file named "count.dat" in your working directory
No comments:
Post a Comment