Hi Michael,
since a few weeks baidu hits my gallerie even its forbidden by robots.txt
so I start looking at your code to get an idea how to disable counting robots.
while doing this I adjust counter.txt by hand (I now: don't do this :-) and the total counter stops counting.
I traced this down to an additional \n inserted from vi after editing the value in counter.txt.
The problem was the implicit string to integer cast from "$zaehler++;" in counter.inc.php.
If the string contains only regular characters the implict cast is working and the counter is increased.
But if the string contains i.e. a \n the implicit cast was not woking, the string stays unchanged and is written back as is to the file.
I solved the problem with an explict cast to integer while reading the value from counter.txt.
afterwards the counter counts again, even if there is a \n.
Code:
from counter.inc.php
[...]
$dateir = fopen($dateiname, "r");
$zaehler = (integer) fgets($dateir, 20); // <- explicit cast string to integer
$closed = fclose($dateir);
}
$zaehler++;
$dateiw = fopen($dateiname, "w+");
fwrite($dateiw, $zaehler);
fclose($dateiw);
[...]