#!/usr/bin/perl

############################################################################
#                                                                          #
# COPYRIGHT NOTICE                                                         #
# Copyright 2001 Hanna Camille Werner - HC Scripts (c)2001                 #
# Not for re-sell or re-distribution.                                      #
#                                                                          #
############################################################################
#                                                                          #
# Setup instructions                                                       #
#                                                                          #
# First of all you have to change the first line in counter.cgi to where   #
# perl is located. If you don't know then ask your sysadm.                 #
#                                                                          #
#                                                                          #
# Enter the full path of the counter log file                              #
$counterfile = "/aide/www/compteur.page";
#                                                                          #
# Add the javascript link to your webpage.                                 #
#                                                                          #
# <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="counter.cgi">  #
# </SCRIPT>                                                                #
#                                                                          #
# Remember to change the SCR to the url of counter.cgi                     #
#                                                                          #
# Now upload counter.cgi and counter.log                                   #
# chmod counter.cgi 775 and chmod counter.log 666                          #
#                                                                          #
# That's it :-)                                                            #
#                                                                          #
#                                                                          #
#                                                                          #
#   Don't forget to link back to hcscripts.com                             #
#                                                                          #
############################################################################


open(COUNT,"$counterfile") || die &error;
$count = <COUNT>;
close(COUNT);


$countnew = $count + 1;

open(COUNT,">$counterfile") || die &error;
print COUNT "$countnew";
close(COUNT);

print "Content-type: text/html \n\n";
print "document.write(\"$countnew\");\n";
# print "$countnew";

sub error
{
print "Content-type: text/html \n\n";
print "Erreur!";
}
