, http://dalager.com, 05-06-2003 * V e r y based on PHP Referer 0.1 by ivan at xpenguin dot com (http://www.xpenguin.com/phpreferer.php). * Should equally be distributed under GPL * * This will _not_ work in safe_mode as it uses the tail command to get a late bite from the apache access log file. * We presume that the log file is in combined log format (http://httpd.apache.org/docs/logs.html) * */ function getReferers(){ # configure the stuff below # your logfile $todaylog = "/home/USERSOMETHING/logs/access_log"; # number of lines to tail - defaults to 1500. Check the referrer density of your logfile to tune performance $linesToTail = 1500; # unique part of location to be monitored for google . ie "weblog" or "~mypage" $inurl = "blog"; # number of referers to show $referersToShow = 10; # ignore the domains listed in the $ignorefile: # (these domains are known referrer spammers so don't feel sorry for them, just put them in there separated by linebreaks # http://yourdomain.com //except for this one that you should replace with your own domain to avoid self-referers # http://www.akksess.com # http://www.worldnewslog.com # http://jennifersblog.com # http://www.malixya.com # http://www.bongohome.com # http://kwlablog.com # http://www.wr18.com # http://mikesplace.com # http://www.saulem.com # http://www.teoras.com # http://bloogz.com # # do not add trailing slashes, must start with http:// # you can add as many as you like # if your site is on a directory on a server, # example: http://something.edu/~username/, # add the /~username to the ignore list $ignorefile = "MT-referer-filter.txt"; # Remove the line below or comment it print "edit the config section inside this file and delete the line that kills it."; exit; # end of config // --------------------- you shouldn't change anything below this line -------------------------------- $referers = array(); error_reporting(1); $tailedLog = `tail -$linesToTail $todaylog`; $arrayOfLines = explode("\n",$tailedLog); end($arrayOfLines); for($i=0;$i".substr($x,7,20)."..."); } } $referers = NULL; $counts = array_values(array_count_values ($final)); $final = array_values(array_unique ($final)); $ccount = 0; $refererCount=0; foreach($final as $x) { print "$x [$counts[$ccount]]
\n"; $ccount++; if($refererCount++ == $referersToShow-1) break; } } ?>