#!/usr/local/bin/php -q "handassoc"); $sites_array["www.michigandrill.com-access_log"]="michdril"; $sites_array["www.republicdrill.com-access_log"]="republic"; $sites_array["www.veritime.com-access_log"]="veritime"; $sites_array["www.tracirtravel.com-access_log"]="tracirtravel"; $sites_array["www.accuratemfg.com-access_log"]="accuratemfg"; $sites_array["www.webisys.com-access_log"]="webisys"; $sites_array["www.western-tool.com-access_log"]="western-tool"; $sites_array["www.tool-equipment.com-access_log"]="tool-equipment"; //etc etc ad naseum ad infinitum reset ($sites_array); while (list($logfile, $outputdir) = each ($sites_array)) { // in PHP 4.0b3 and newer: $pos = strpos ($logfile, "-access_log"); if ($pos === true) { $hostname=substr($logfile,0,$pos); //strip off the -access_log leaving just the hostname $short_hostname=str_replace("www.","",$hostname); $logfile="/var/log/httpd/".$logfile; $filehandle=fopen('/root/webalizer.tmp','w+'); rewind($filehandle); //The following lines ensure that clicks from one page within a domain to //another do not register as refering pages when webalizer parses the log file //this ensures that you see who actually is referring traffic to your sites fwrite($filehandle,"HideReferrer $hostname\n"); fwrite($filehandle,"HideReferrer $short_hostname\n"); fclose($filehandle); //now add in the webalizer directives common to every domain from the webalizer.min we created earlier exec('cat /root/webalizer.min>>/root/webalizer.tmp'); $exec_string="/usr/local/bin/webalizer -Q -c /root/webalizer.tmp -n $hostname -o $outputdir $logfile"; echo $exec_string."\n"; //echo "Logfile: $logfile\n OutputDir: $outputdir\n HostName $hostname\n\n"; system($exec_string); } } ?>