Hello, i have a bot detection script here that im unsure if its correct, could someone look at it and see if there are errors in it?
thanks for the help
<b>Bots online:</b>
<?php
function GetBotList(){
$BotList = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly",
"NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler",
"www.galaxy.com", "Googlebot", "Googlebot/2.1", "Google Webmaster", "Scooter", "James Bond", "Slurp",
"msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz", "Baiduspider", "Feedfetcher-Google",
"TechnoratiSnoop", "Rankivabot", "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler", "MJ12bot",
"Yandex/", "YaDirectBot", "StackRambler","DotBot","dotbot","Baidu Ezooms","Ezooms","AdsBot-Google","Mediapartners-Google","Mediapartners","Googlebot-Video/1.0","Googlebot-News");
return $BotList;
}
function DetectBot(){
$BotList = GetBotList();
foreach($BotList as $bot) {
if(strpos($bot, $_SERVER['HTTP_USER_AGENT'])) {
return $bot;
}
}
return false;
}
$is_robot = DetectBot();
if($is_robot){
foreach ($is_robot as $is_robot) {
echo ucfirst($is_robot) . ' ';
}
}
?>