How to make a counter
You can always include one of the available counter services.
Read the
Access Counter FAQ or
Yahoo's counter list.
The shortest (own) counter I know: If you have the unix command banner:
#!/bin/sh
CNTFILE=/usr/local/www/httpd/logs/count
count=`cat $CNTFILE`; count=`expr $count + 1`; echo $count > $CNTFILE
echo Content-type: text/xbm; echo
banner "["$count"]" | tr ' ' '+' | sed -e 's/+/0/g' | sed -e 's/#/1/g' | \
sed -e 'p' | atobm -c 01
- Save this in the cgi-scripts directory of your server. Chmod +x it.
- Banner is available on ftp servers. There are different versions with different options and functinality, but some will work here.
- Start with a '0' in /usr/local/www/httpd/logs/count. The count is not secure without file locking. Two acceses at the same time will sometimes reset it :-(.
But a little bit more effort can make it secure.