First make a new file called stats.txt and one called stats.php

Give write permission on the .txt file (CHMOD 666 or 777 if you don`t see a growing count)

php code for .php file

//set data file name/path
//read content fom the .txt file
$show = file_get_contents($data);
//write new content to the .txt file
//show your hit counter
echo $show;

This is faster thran fopen() and if the data file dose not exists the script creates it, if it can.

Simple text based hit counter
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *