#!/usr/bin/perl
#
# webalizer web gateway
#
# config section
$logfile_path = "/www/logs/";
$domain = $ENV{'SERVER_NAME'};
$root_dir = $ENV{'SERVER_NAME'};
$root_dir =~ s/\.com|\.net|\.org|\.info|\.coop//i;
$root_dir =~ s/www.//i;
$domain =~ s/www.//i;

$stats_path = "/www/htdocs/$root_dir/stats/";


# end config
#

$logfile = $logfile_path.$domain."-access_log";
$out=`/usr/local/bin/webalizer -p -o $stats_path -n $domain $logfile`;
#$out="/usr/local/bin/webalizer -p -o $stats_path -n $domain $logfile";

#print "Content-type: text/html\n\n";

#print "logfile = $logfile<P>";
#print "out = $out";
#exit;

#print "<HTML><BODY> out=$out";
print "Location: http://$domain/stats/\n\n";
exit;

