Jump to content

intenseone345

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by intenseone345

  1. Ok why is this not valid syntax? thanks for your help <?php public function isBot() { /* This function will check whether the visitor is a search engine robot */ $bots = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz", "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot", "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot", "Butterfly","Twitturls","Me.dium","Twiceler","Yahoo","Bling","bingbot","ezooms","Baidu"); foreach($bots as $bot) { if(strpos, strtolower($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; } return false; } if(isBot()) { echo ucfirst($bot) . ' '; } else { echo 'no bots'; } ?>
  2. Im thinking maybe like this but it wont return the name of the bot done this way. Also would anyone know how to test a script like this making your own own browser look like a bot, i tried adding "Mozilla" in the array but it did not work? <?php protected function isBot() { /* This function will check whether the visitor is a search engine robot */ $bots = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz", "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot", "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot", "Butterfly","Twitturls","Me.dium","Twiceler","MSIE","Microsoft Internet Explorer","Mozilla/4.0"); foreach($bots as $bot) { if(strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; } return false; } if (!isBot()) { echo "human"; } if (is_bot()) { echo "bot"; } ?>
  3. Hello, how can i add a function call within this php script to echo the result as either "the bot is" or "no bots found" im not sure on how to code it and make use of this script? Thanks <?php protected function isBot() { /* This function will check whether the visitor is a search engine robot */ $bots = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz", "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot", "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","TweetmemeBot", "Butterfly","Twitturls","Me.dium","Twiceler"); foreach($bots as $bot) { if(strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; } return false; } ?>
  4. Thanks for the help i will give it a whirl, i did not work befor maybe it will now.
  5. 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) . ' '; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.