#!/ext/user.local/computer/a61/perl/bin/perl #******************** countbew.pl ****************************************** # PODIUM Bureau voor educatieve communicatie # Alexander Martens (6/6/1996) # SVK-op Internet #************************************************************************** # verscholen counter file voor bewegingswerken.html # # flush de i/o buffer meteen $| = 1; #$exclusive_lock = 2; #$unlock_lock = 8; $counter_file = "/cp/htdocs/Netherlands/pavilions/techno/svk/write/countbew.txt"; $no_visitors = 1; if (! (-e "/cp/htdocs/cgi-bin/Netherlands/svk/LOCAL")) { $lock = 1; } else { $lock = 0; } # er is al een counter-file dus probeer te openen, en op te hogen if (! ((-r $counter_file) && (-w $counter_file)) ) { print "Geen lezen mogelijk\n"; &return_error (500, "Counter Error", "Cannot read or write "); } else { open (COUNTER, "<" . $counter_file); if ($lock) { flock (COUNTER, $exclusive_lock); } $no_visitors = ; if ($lock) { flock (COUNTER, $unlock_lock); } close (COUNTER); $no_visitors++; open (COUNTER, ">" . $counter_file); if ($lock) { flock (COUNTER, $exclusive_lock); } print COUNTER $no_visitors; if ($lock) { flock (COUNTER, $unlock_lock); } close (COUNTER); } # maak nu het gif-plaatje if (open(IMAGE, "; } exit(0); sub return_error { # geef een foutmelding terug local ($status, $keyword, $message) = @_; print "Content-type: text/html", "\n"; print "Status: ", $Status, " ", $keyword, $keyword,"\n\n"; exit(1); }