Kolla bara om besökaren är från ditt egna ip. Om inte, så gör du funktionen counter
<?php
$cfile = "count.txt"; // The filename of the counter, has to be chmod 777.
function counter($filename) {
$fd = fopen($filename, "r+");
$contents = fread($fd, filesize ($filename));
$contents = $contents +1;
fclose($fd);
$fd = fopen($filename, "w+");
$write = fputs($fd, $contents, strlen($contents));
fclose($fd);
}
function showcounter($filename) {
$fd = fopen($filename, "r+");
$contents = fread($fd, filesize ($filename));
fclose($fd);
return $contents;
}
if($_SERVER['REMOTE_ADDR'] != "192.168.0.1"){
counter($cfile); // Adds/counts a visitor.
}
echo showcounter($cfile); // Prints the number of visitors.
?>
Byt ut 192.168.0.1 till ditt lokala IP.
