#!/usr/local/bin/perl
####################################################################
# #
# SSI Text Counter #
# Kastle Internet Services #
# http://www.kastle.net #
# kastle@kastle.net #
# #
####################################################################
# $
# THIS PROGRAM MAY BE USED AND DISTRIBUTED FREELY PROVIDED #
# NO MODIFICATIONS ARE MADE TO THE CODE. #
# #
# Copyright (c) 1998 - Kastle Internet Services #
# All rights reserved #
# Written & Tested by Kastle Internet Services #
# gatekeeper@kastle.net #
# #
# #
####################################################################
# DISCLAIMER: #
# #
# In no event will Kastle Internet Services be liable to the user #
# of this script or any third party for any damages, including #
# any lost profits, lost savings or other incidental, #
# consequential or special damages arising out of the operation #
# of or inability to operate this script, even if user has been #
# advised of the possibility of such damages. #
# #
####################################################################
require "counter.conf";
#########################################
# DO NOT EDIT BELOW THIS LINE #
#########################################
$pagepath = $ENV{'DOCUMENT_URI'};
print "Content-type: text/html\n\n";
open(FILE, ">>$counter_file");
close(FILE);
open(FILE, "$counter_file");
@indata = ;
close(FILE);
$onoff = 0;
open(FILE, ">$counter_file");
foreach $temp (@indata)
{
chop($temp);
($uri, $count) = split(/\|/, $temp);
if ($uri eq $pagepath) {
$count++;
$onoff = 1;
print FILE "$uri|$count\n";
print "$count"; }
else { print FILE "$uri|$count\n"; }
}
if ($onoff eq 0) {
print FILE "$pagepath|1\n";
print "1"; }
close(FILE);