Question : counter(s)

I have a project that I am working on, and I am not very well versed in perl...

what I need from perl is a counter that will work for "thousands" of web pages and sites... I heard perl was the place to look, and I am not knowledgeable in perl, so I don't know how to set up a counter program that will handle all of these websites "separately"...

If this question is easy... I apologize in the beginning...

But I would appreciate any input that you might have...

thank you...

Answer : counter(s)

For text output use this script
#!/usr/local/bin/perl

#Name: counter.cgi

#Get query string values or form values
&parseInput;

# Application will access a value in a file,
# increment it, write this new value out to the
# file, and print the current value out to
# standard output. The script assumes that the file
# which maintains the necessary count (In this way
# you can use the same script for many different counts
#
# print out content type
print "Content-type: text/html\n\n";

# get current count
open(COUNTER, "< $fields{'counter_file'}") || die "BUSY";
$value =
close(COUNTER);

# increment count and write back out to file
$value++;
open(COUNTER, "> $fields{'counter_file'}") || die "BUSY";
print COUNTER $value;
close(COUNTER);
#
print $value;

exit(0);

Then reference it in the html doc where the count is to appear like this:

Number of visitors is :


!!!!!!Carefull!!!!!!!!!!

The SSI exec cgi command must be turned on.  On many comercial hosting services it is turned off.

Try this if it fails:



The xxxxxx's indicate that you now must include the complete path to your script starting from root (/).
Random Solutions  
 
programming4us programming4us