I have a simple counter on my page, it uses a text file to store the data, it's the one that I found everywhere on t he web but it won't work for me. The problem is it pulls the countnumber from the file, increments it, prints it, and then it is supposed to store the new countnumber. I think that is the problem. Here's my code:
<?php
$counter_file = "http://12.245.189.164/design/count.txt";
if (!($fp = fopen($counter_file, "r"))) die ("Cannot Open $counter_file.");
$counter = (int) fread($fp, 20);
fclose($fp);
$counter++;
echo "You are visitor Number $counter.";
$fp = fopen($counter_file, "w");
fwrite($fp, $counter);
fclose($fp);
?>