Michael W.: Counter

Beitrag lesen

Mit PHP hatte ich halt bisher nichts zu tun, aber so sollte es gehen *hoff*

schreiben ohne anzeige:
<?php

$file = "counter.txt";

$data = fopen($file, "r");
$count = fread($data, filesize($file));
fclose($data);

$count = ++$count;

$data = fopen($file, "w+");
fwrite($data, $count);
fclose($data);

?>
(ohne echo)
____________
anzeigen ohne schreiben:

<?php

$file = "counter.txt";

$data = fopen($file, "r");
$count = fread($data, filesize($file));
fclose($data);

echo $count;

?>

obwohl man im prinzip ja nur $count = ++$count; weglassen müsste, weil das ja den count um 1 erhöt.

ist das jetzt richtig ??

und noch ne frage:
wie kann ich jetzt den counterstand mit einem formular beliebig setzen ?