1) Text counter
$countfile="/count.txt"; //Set the file to save the data
if (!file_exists($countfile)){// Determine whether the file exists
exec( "echo 0 > $countfile");
}
$fp = fopen($countfile,"rw");
$length=filesize($countfile);
$num = fgets($ fp,$length);
$num += 1;
exec( "rm -rf $countfile");
exec( "echo $num > $countfile");
print "Total visits:"."$ num"."person times"; //Show the number of visits
?>
2) Graphic counter
$countfile="/count-num.txt"; //Set the file to save the data
if (!file_exists ($countfile)) //Determine whether the file exists
{exec( "echo 0 > $countfile");}
$fp = fopen($countfile,"rw");
$length=filesize($countfile);
$num = fgets($fp,$length);
$num += 1;
exec( "rm -rf $countfile");
exec( "echo $num > $countfile");
$len_str = strlen($num);
for($i=0;$i<$len_str;$i++){
$each_num = substr($num,$i,1);
$out_str = $out_str . "";
}
print "Total visits:"."$out_str"."Persons"; //Display the number of visits
?>