nightman0007
ISP
Hi
I have a simple perl script to count hits on my website.
But now I need to develop bit more. so I have few questions.
I need to call the scripts with a variable as follows.
visible='yes' - show the counter
visible='no' - hide the counter
also I need to have the option as "not count me" so my visits will not be counted. I may need to put my IP in the script.
also when I have the counter in frame pages the counter count multiple times. but this should be done only once, even if I have the counter called in multiple pages in the frame. is it possible?
<!--#exec cgi="./cgi-bin/counter5.pl?visible=xx" -->
#!/usr/bin/perl -w
use warnings;
use strict;
use CGI qw/:standard/;
my $file = "counter.dat";
open( LOG, "$file" ) or die "Cannot open file $!";
my $cnt = <LOG>;
close(LOG);
++$cnt;
open( LOG, "> $file" ) or die "Cannot open file $!";
print LOG $cnt;
close(LOG);
print STDOUT "Content-type: text/html\n\n";
print "$cnt";
Thank you.
I have a simple perl script to count hits on my website.
But now I need to develop bit more. so I have few questions.
I need to call the scripts with a variable as follows.
visible='yes' - show the counter
visible='no' - hide the counter
also I need to have the option as "not count me" so my visits will not be counted. I may need to put my IP in the script.
also when I have the counter in frame pages the counter count multiple times. but this should be done only once, even if I have the counter called in multiple pages in the frame. is it possible?
<!--#exec cgi="./cgi-bin/counter5.pl?visible=xx" -->
#!/usr/bin/perl -w
use warnings;
use strict;
use CGI qw/:standard/;
my $file = "counter.dat";
open( LOG, "$file" ) or die "Cannot open file $!";
my $cnt = <LOG>;
close(LOG);
++$cnt;
open( LOG, "> $file" ) or die "Cannot open file $!";
print LOG $cnt;
close(LOG);
print STDOUT "Content-type: text/html\n\n";
print "$cnt";
Thank you.