$counter_file = ("counter.txt"); //file where count is stored
$visits = file($counter_file); //puts the count in a variable
$visits[0]++; //add 1 to the counter
$fp = fopen($counter_file , "w"); //open the file for write
fputs($fp , "$visits[0]"); //write the new value to the file
fclose($fp); //close the file
print $visits[0] . "";
?>
|