#!/usr/local/bin/perl # # counter.pl # version 961110 # copyright 1996 by bo larsson # all rights reserved # # bugs or feedback to bliss@seagull.net # for information on how to use, visit http://www.seagull.net/bliss/ # # put this program in a directory by itself (it will create a bunch of files) # and make sure this directory is world-writeable (chmod 777) print "Content-type: text/html\n\n"; ($the_count = $ENV{'DOCUMENT_URI'}) =~ s/\//_/g; if (!(-e $the_count)) { open(THE_COUNT,">$the_count"); $counter=1; print "$counter"; print THE_COUNT ++$counter; close(THE_COUNT); } else { open(THE_COUNT,"+<$the_count"); flock(THE_COUNT,2); $counter=; print "$counter"; seek(THE_COUNT,0,0); print THE_COUNT ++$counter; flock(THE_COUNT,8); close(THE_COUNT); }