Friday, February 5, 2010

Calculate Visitor Counter

Follow the step
1. Create a file name "visitcount.dat"
2. Upload the file in webserver
3. make file permission CHMOD *777*
Now Insert the PHP code below

$counterfile = "visitcount.dat";
if(!($fp = fopen($counterfile,"r"))) die ("cannot open counter file");
$count = (int) fread($fp, 20);
echo "Total hit counter: $count";
$fp = fopen($counterfile, "w");
fwrite($fp , $count);

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off