#!/usr/bin/perl
#
# based on ``CGI Programming in the WWW, Shishir Gundavaram, O'Reilly Assoc., Inc.,
# pp. 94
#
# Modified by J.E. Klasek, 2/1997
#

print "Content-type: text/plain\n\n";

$count_file="wpp_remote_counter.dat";

if  (open(FILE, "<$count_file")) {
    $access_count = <FILE>;
    close(FILE);

    if  (open(FILE, ">$count_file")) {
	$access_count++;
	print FILE "$access_count";
	close(FILE);
	
	print $access_count;
    }
    else {
	print "[ Unable to increment counter! ]\n";
    }
}
else {
	print "[ Unable to read the counter! ]\n";
}

exit(0);
