kitty litter

Physical web page hit counter

On the my web server, create a text file to keep the hits number(e.g.hits.txt) with set file permission to chmod 755 or 777 then place the PHP script below on any page that you need to count the page hits. The hits.txt will be fetched by the Opto software.

<?php
$hitfile = $_SERVERDOCUMENT_ROOT?.”/counter/hits.txt”;
$hits = @file_get_contents($hitfile);
file_put_contents($hitfile,$hits+1,LOCK_EX);
echo ($hits+1); // comment this line if do not want to display
?>;

 

 

Leave a comment