#! /usr/bin/perl -w ########################################################################### # Author: Joe Klemmer # Date: July 27nd, 1999 # License: Public Domain # # This script is 100% free and can be used and abused by anyone for # anything they want. # # Description: This is a very "down-n-dirty" page counter script. # It will keep a count of page accesses and display them as text output. # This can be used as a Server Side Include (SSI) script for your web # server. # # Usage: 'count.pl ' # # where is a text file containing the current number # of hits. # ########################################################################### # First make sure that the data file exists. # If it doesn't set the counter to zero. # if (open(IN,"@ARGV")) { while(){ $count=$_; } } else { $count=0; } close(IN); # Open the file for output. # open(OUT,">@ARGV") or die "Can't open file: $!"; # Increment the counter by one. # $count++; # Print the counter to the file then to stdout so # that it can be included in the web pages. # print OUT $count; print $count."\n"; # Close the data file and exit the program. # close(OUT); exit;