Location: PHPKode > scripts > Bot Monitor > bm.php
<?php

include('bm-settings.php');

$ip=$_SERVER['REMOTE_ADDR'];

$botid= $_SERVER['HTTP_USER_AGENT'];
$bot="";
if(eregi("GoogleBot",$botid))
  $bot = "GoogleBot";
elseif(eregi("Googlebot/2.1",$botid))
  $bot = "Googlebot/2.1";
elseif(eregi("search-o-rama",$botid))
  $bot = "search-o-rama";
elseif(eregi("FAST-WebCrawler",$botid))
  $bot = "Alltheweb";
elseif(eregi("Speedy Spider",$botid))
  $bot = "Entireweb";
elseif(eregi("ArchitextSpider",$botid))
  $bot = "Exite";
elseif(eregi("Ask",$botid))
  $bot = "Ask.com/Teoma";
elseif(eregi("GigaBot",$botid))
  $bot = "GigaBot (http://www.gigablast.com)";
elseif(eregi("Inktomi Slurp",$botid))
  $bot = "Inktomi Slurp";
elseif(eregi("MSNbot",$botid))
  $bot = "MSNbot"; 
elseif(eregi("Yahoo",$botid))
  $bot = "Yahoo";
elseif(eregi("InfoSeek Robot 1.0",$botid))
  $bot = "InfoSeek Robot 1.0";
elseif(eregi("Infoseek Sidewinder",$botid))
  $bot = "Infoseek Sidewinder";
elseif(eregi("Slurp/2.0 (hide@address.com; http://www.inktomi.com/slurp.html)",$botid))
  $bot = "Slurp/2.0 (hide@address.com; http://www.inktomi.com/slurp.html)";
elseif(eregi("Slurp",$botid))
  $bot = "Slurp (hide@address.com; http://www.inktomi.com/slurp.html)";
elseif(eregi("ia_archiver",$botid))
  $bot = "Alexa";
elseif(eregi("Lycos_Spider_(T-Rex)",$botid))
  $bot = "Lycos";
elseif(eregi("Scrubby/",$botid))
  $bot = "ScrubTheWeb";
elseif(eregi("appie",$botid))
  $bot = "Walhello";
elseif(eregi("CoolBot",$botid))
  $bot = "CoolBot";
elseif(eregi("Yandex",$botid))
  $bot = "Yandex";
elseif(eregi("libwww-perl",$botid))
  $bot = "libwww-perl";
elseif(eregi("Norbert the Spider",$botid))
  $bot = "Norbert the Spider(Burf.com)";
elseif(eregi("geourl",$botid))
  $bot = "geourl http://geourl.org/bot";
elseif(eregi("Technoratibot",$botid))
  $bot = "Technoratibot";
elseif(eregi("Exabot",$botid))
  $bot = "Exabot";
elseif(eregi("schibstedsokbot",$botid))
  $bot = "schibstedsokbot (http://www.schibstedsok.no/bot/)";
elseif(eregi("FAST FreshCrawler",$botid))
  $bot = "FAST FreshCrawler (http://www.schibstedsok.no/bot/)";
elseif(eregi("FAST FreshCrawler",$botid))
  $bot = "FAST FreshCrawler (http://www.schibstedsok.no/bot/)";
elseif(eregi("FAST Enterprise Crawler agent 007",$botid))
  $bot = "FAST Enterprise Crawler agent 007(hide@address.com / www.fastsearch.com)";
elseif(eregi("FAST Enterprise Crawler",$botid))
  $bot = "FAST Enterprise Crawler (http://www.fastsearch.com)";
elseif(eregi("ZyBorg",$botid))
  $bot = "ZyBorg/1.0 Dead Link Checker (hide@address.com; http://www.WISEnutbot.com)";
elseif(eregi("NutchCVS",$botid))
  $bot = "NutchCVS/0.06-dev (Nutch; http://www.nutch.org/docs/en/bot.html; nutch-hide@address.com)";
elseif(eregi("aipbot",$botid))
  $bot = "aipbot/1.0 (aipbot; http://www.aipbot.com; hide@address.com)";
elseif(eregi("BruinBot",$botid))
  $bot = "BruinBot (+http://webarchive.cs.ucla.edu/bruinbot.html)";
elseif(eregi("Asterias Crawler",$botid))
  $bot = "Asterias Crawler v4; +http://www.singingfish.com/help/spider.html; hide@address.com)";
elseif(eregi("Baiduspider",$botid))
  $bot = "Baiduspider+(+http://www.baidu.com/search/spider.htm)";
elseif(eregi("Ask Jeeves/Teoma",$botid))
  $bot = "Ask Jeeves/Teoma; (http://sp.ask.com/docs/about/tech_crawling.html)";
elseif(eregi("psbot",$botid))
  $bot = "psbot/0.1 (+http://www.picsearch.com/bot.html)";
elseif(eregi("Dumbot",$botid))
  $bot = "Dumbot(version 0.1 beta - http://www.dumbfind.com/dumbot.html)";
elseif(eregi("ConveraCrawler",$botid))
  $bot = "ConveraCrawler/0.9d (+http://www.authoritativeweb.com/crawl)";
elseif(eregi("SBIder",$botid))
  $bot = "SBIder/0.8-dev (SBIder; http://www.sitesell.com/sbider.html; http://support.sitesell.com/contact-support.html)";
elseif(eregi("MJ12bot",$botid))
  $bot = "MJ12bot/v1.0.3 (http://majestic12.co.uk/bot.php?+)";
elseif(eregi("Sensis Web Crawler",$botid))
  $bot = "Sensis Web Crawler (search_comments\at\sensis\dot\com\dot\au)"; 
elseif(eregi("Feedster Crawler",$botid))
  $bot = "Feedster Crawler/1.0; Feedster, Inc";
elseif(eregi("Google-Sitemaps",$botid))
  $bot = "Google-Sitemaps";
elseif(eregi("Mediapartners-Google",$botid))
  $bot = ""; 
elseif(eregi("XML Sitemaps Generator",$botid))
  $bot = ""; 
elseif(eregi("Megaglobe Crawler",$botid))
  $bot = "Megaglobe Crawler/1.0; http://www.megaglobe.com";
elseif(eregi("Microsoft URL Control",$botid))
  $bot = "Microsoft URL Control - 6.00.8169; http://www.megaglobe.com";
elseif(eregi("IRLbot",$botid))
  $bot = "IRLbot/2.0 (http://irl.cs.tamu.edu/crawler)";
elseif(eregi("OmniExplorer_Bot",$botid))
  $bot = "OmniExplorer_Bot/6.68 (+http://www.omni-explorer.com) WorldIndexer";
elseif(eregi("libwww-FM",$botid))
  $bot = "Lynx/2.8.5dev.7 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6b";
elseif(eregi("BlogsNowBot",$botid))
  $bot = "BlogsNowBot, V 3.0 (+http://www.blogsnow.com/)";
elseif(eregi("HolyCowDude",$botid))
  $bot = "HolyCowDude/0.2 Feeds Searcher (http://www.holycowdude.com/spider.html)";
elseif(eregi("NG/",$botid))
  $bot = "NG/2.0";
elseif(eregi("Sphere Scout",$botid))
  $bot = "Sphere Scout&v4.0 (beta) - scout at sphere dot com";
elseif(eregi("STEROID",$botid))
  $bot = "STEROID  Download";
elseif(eregi("http://www.cj.com/networkquality",$botid))
  $bot = "http://www.cj.com/networkquality";
elseif($ip=='216.34.209.23')
  $bot = "http://www.cj.com/networkquality";
else {

     }
 
if($bot)
{
$siteaddress = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	if ($sendemail=="Y"){
			$subject = "$bot Spider Visited $siteaddress";
			
			
			$datev = date("l, d F, Y h:i:s a");
			$text = "Hi $name,\n\n $bot spider visited your site page http://$siteaddress on $datev. \n\n With IP Address $ip\n\n Regards,\n\n Regards,\n\n Bot Monitor 1.1 (http://www.BlueWaterWebDesigns.com)";
			  
			mail("$emailto", "$subject", $text, 'From: Bot Monitor <BM@"'.$siteurl.'">');
	}
	if ($usedatabase=="Y"){
			dbinit();
			$insertquery="INSERT INTO bwwd_bm (ip,bot,visit,page) VALUES ('$ip','$bot','$datev','http://$siteaddress')";
			$result=mysql_query($insertquery) or die(mysql_error());
	
	}
}
?>
Return current item: Bot Monitor