Hi!
Hier die funktionierende Version eines Downloadcounters:
[code]
<?php $datei = fopen("counter.txt","r+"); $counterstand = fgets($datei, 10); if($counterstand == "") { $counterstand = 0; } $counterstand++; echo $counterstand; rewind($datei); fwrite($datei, $counterstand); fclose($datei); ?>[/code]Wenn ich nun echo $counterstand; auskommentiere funktioniert das Skript nicht mehr richtig, da es auf einmal immer mit einem Aufruf 3 zum aktuellen Counterstand hinzuzählt:
[code]
<?php $datei = fopen("counter.txt","r+"); $counterstand = fgets($datei, 10); if($counterstand == "") { $counterstand = 0; } $counterstand++; //echo $counterstand; rewind($datei); fwrite($datei, $counterstand); fclose($datei); ?>[/code]Warum zum Teufel ist das so???
Danke schonmal für eure Hilfe!
