It is easy, but you need to have write privileges on that file
(or rather httpd needs that) - so you may include a test that
this file only holds a number as a minimal protection.
$filename = $GLOBALS[DOCUMENT_ROOT]/your_counter.txt;
$fp = fopen($filename,a+);
$cnt = fread( $fp, filesize($filename));
fclose($fp);
if ($cnt == ) {
$cnt = 0;
}
$cnt++;
$fp = fopen($filename,w);
$res = fwrite($fp, (string)$cnt);
fclose($fp);
Kyle Smith schrieb am Mittwoch, 1. August 2001, 22:12:35:
Is it possible to make a website counter with a PHP script and a text document? If
so can somebody email me a script (unlikely) or send me to a page with a script (yay)
-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!
ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666
--
Herzlich
Werner Stuerenburg
_
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 ยท Fax 0(049) 5224-997 409
http://pferdezeitung.de
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]