if you just want to count the traffic you sent to a specific url and don't need any fancy administration / stats GUI
Code:
#!/usr/bin/perl
# Set Variables
# This is the counter log filename
$databasefile = '../html/stats/iwonderiftheycounallthetrafficisend.txt';
# This is your main URL path
$YourURL = 'http://www.domain.com';
##########################################################
$originallink = "$ENV{'QUERY_STRING'}";
# v3.5 - Get remote file
if ((substr($originallink, 0, 7) eq 'http://') ||
(substr($originallink, 0, 6) eq 'ftp://')) {
$link = $originallink;
}
else {
$link = "$YourURL/$originallink"; # YourURL + Link to file
}
open(DB,"+<$databasefile") || die $!;
flock(DB,2); # Locking file
seek(DB,0,0);
@DATA = <DB>;
$SIZE = @DATA;
$i = 0;
while ($i <= $SIZE) {
($counter,$oldlink) = split(/`/,$DATA[$i]);
chop($oldlink);
if ($oldlink eq $originallink) {
$counter++;
$DATA[$i] = "$counter`$originallink\n";
goto LocateLink;
}
$i++;
}
push @DATA, "1`$originallink\n";
LocateLink:
@DATA = sort {($b =~ /(\d+)/)[0] <=> ($a =~ /(\d+)/)[0]} @DATA;
seek(DB,0,0);
print(DB @DATA);
truncate(DB,tell(DB));
flock(DB, 8); # Unlocking file
close(DB);
print "Location: $link\n\n";
i found that piece of code a while ago and use it to count all the traffic is send to specific urls
you just need to create a *.txt file and start to send all traffic through count.cgi or however you want to name it
i'm sure it can handle 100k clicks per hour without slowing your server down.
