1. Begin with a blank page and put a “1” without the quotes in it and name it “counter.txt”, chmodd it to 777. 2. Create another page and put this code in it.
// File name.
$file = "counter.txt"; // Lets open a connection, shall we?
$fp = @fopen($file, "r+"); // Open the file.
$myCounter = (int)fgets($fp,10000); // Add another entry.
rewind($fp); // Save new entry into file.
fwrite($fp,$myCounter); // After using something, close it.
fclose($fp);<br> // Print results.
echo 'Page Views:' .$myCounter;
3. Name this file counter.php
4. Put this code where you want the counter to be.