Counter
  • What is a counter?
  • A counter is something use to see how many visitors a day on your site more important Unique visitors.

First thing first. Make a folder name it counter on your FTP or Cpanel
Open a blank document on Notepad or other Editors. Save the document counter.txt, Upload it to your folder counter
CHMOD counter.txt to 777
Open Notepad on a blank document add the following code
< $filename = "YOURCOUNTER.TXT"; $file = file($filename); $file = array_unique($file); $hits = count($file); echo $hits; $fd = fopen ($filename , "r"); $fstring = fread ($fd , filesize ($filename)); fclose($fd); $fd = fopen ($filename , "w"); $fcounted = $fstring."n".getenv("REMOTE_ADDR"); $fout= fwrite ($fd , $fcounted ); fclose($fd);
  • ADD ?php after the < at the begining of the code
  • ADD ?> at the end of the code after the ;
  • Save the document to counter.php
  • This is a UNIQUE VISITORS COUNTER only counts 1 IP address.
  • counter.txt hold the number of unique visitors and loads by alternative Ip
If you want to show it in include
< include ("URL/TO/FILE/counter.php"); >
  • Add the ?php after the < before include
  • Delete the "URL/TO/FILE/counter.php" change it to 'home/YOURCPANELUSERNAME/counter/counter.php'
  • at last add the ? after the ; before the >