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);
fclose($fp);
$count++;
echo "Total hit counter: $count";
$fp = fopen($counterfile, "w");
fwrite($fp , $count);
fclose($fp);
No comments:
Post a Comment