<?php

$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$bannedISPs = array("abot", "dbot", "ebot", "hbot", "kbot", "lbot", "mbot", "nbot", "obot", "pbot", "rbot", "sbot", "tbot", "vbot", "ybot", "zbot", "bot.", "bot/", "_bot", ".bot", "/bot", "-bot", ":bot", "(bot", "crawl", "slurp", "spider", "seek", "accoona", "acoon", "adressendeutschland", "ah-ha.com", "ahoy", "altavista", "ananzi", "anthill", "appie", "arachnophilia", "arale", "araneo", "aranha", "architext", "aretha", "arks", "asterias", "atlocal", "atn", "atomz", "augurfind", "backrub", "bannana_bot", "baypup", "bdfetch", "big brother", "biglotron", "bjaaland", "blackwidow", "blaiz", "blog", "blo.", "bloodhound", "boitho", "booch", "bradley", "butterfly", "calif", "cassandra", "ccubee", "cfetch", "charlotte", "churl", "cienciaficcion", "cmc", "collective", "comagent", "combine", "computingsite", "csci", "curl", "cusco", "daumoa", "deepindex", "delorie", "depspid", "deweb", "die blinde kuh", "digger", "ditto", "dmoz", "docomo", "download express", "dtaagent", "dwcp", "ebiness", "ebingbong", "e-collector", "ejupiter", "emacs-w3 search engine", "esther", "evliya celebi", "ezresult", "falcon", "felix ide", "ferret", "fetchrover", "fido", "findlinks", "fireball", "fish search", "fouineur", "funnelweb", "gazz", "gcreep", "genieknows", "getterroboplus", "geturl", "glx", "goforit", "golem", "grabber", "grapnel", "gralon", "griffon", "gromit", "grub", "gulliver", "hamahakki", "harvest", "havindex", "helix", "heritrix", "hku www octopus", "homerweb", "htdig", "html index", "html_analyzer", "htmlgobble", "hubater", "hyper-decontextualizer", "ia_archiver", "ibm_planetwide", "ichiro", "iconsurf", "iltrovatore", "image.kapsi.net", "imagelock", "incywincy", "indexer", "infobee", "informant", "ingrid", "inktomisearch.com", "inspector web", "intelliagent", "internet shinchakubin", "ip3000", "iron33", "israeli-search", "ivia", "jack", "jakarta", "javabee", "jetbot", "jumpstation", "katipo", "kdd-explorer", "kilroy", "knowledge", "kototoi", "kretrieve", "labelgrabber", "lachesis", "larbin", "legs", "libwww", "linkalarm", "link validator", "linkscan", "lockon", "lwp", "lycos", "magpie", "mantraagent", "mapoftheinternet", "marvin/", "mattie", "mediafox", "mediapartners", "mercator", "merzscope", "microsoft url control", "minirank", "miva", "mj12", "mnogosearch", "moget", "monster", "moose", "motor", "multitext", "muncher", "muscatferret", "mwd.search", "myweb", "najdi", "nameprotect", "nationaldirectory", "nazilla", "ncsa beta", "nec-meshexplorer", "nederland.zoek", "netcarta webmap engine", "netmechanic", "netresearchserver", "netscoop", "newscan-online", "nhse", "nokia6682/", "nomad", "noyona", "nutch", "nzexplorer", "objectssearch", "occam", "omni", "open text", "openfind", "openintelligencedata", "orb search", "osis-project", "pack rat", "pageboy", "pagebull", "page_verifier", "panscient", "parasite", "partnersite", "patric", "pear.", "pegasus", "peregrinator", "pgp key agent", "phantom", "phpdig", "picosearch", "piltdownman", "pimptrain", "pinpoint", "pioneer", "piranha", "plumtreewebaccessor", "pogodak", "poirot", "pompos", "poppelsdorf", "poppi", "popular iconoclast", "psycheclone", "publisher", "python", "rambler", "raven search", "roach", "road runner", "roadhouse", "robbie", "robofox", "robozilla", "rules", "salty", "sbider", "scooter", "scoutjet", "scrubby", "search.", "searchprocess", "semanticdiscovery", "senrigan", "sg-scout", "shai'hulud", "shark", "shopwiki", "sidewinder", "sift", "silk", "simmany", "site searcher", "site valet", "sitetech-rover", "skymob.com", "sleek", "smartwit", "sna-", "snappy", "snooper", "sohu", "speedfind", "sphere", "sphider", "spinner", "spyder", "steeler/", "suke", "suntek", "supersnooper", "surfnomore", "sven", "sygol", "szukacz", "tach black widow", "tarantula", "templeton", "/teoma", "t-h-u-n-d-e-r-s-t-o-n-e", "theophrastus", "titan", "titin", "tkwww", "toutatis", "t-rex", "tutorgig", "twiceler", "twisted", "ucsd", "udmsearch", "url check", "updated", "vagabondo", "valkyrie", "verticrawl", "victoria", "vision-search", "volcano", "voyager/", "voyager-hc", "w3c_validator", "w3m2", "w3mir", "walker", "wallpaper", "wanderer", "wauuu", "wavefire", "web core", "web hopper", "web wombat", "webbandit", "webcatcher", "webcopy", "webfoot", "weblayers", "weblinker", "weblogmonitor", "webmirror", "webmonkey", "webquest", "webreaper", "websitepulse", "websnarf", "webstolperer", "webvac", "webwalk", "webwatch", "webwombat", "webzinger", "wget", "whizbang", "whowhere", "wild ferret", "worldlight", "wwwc", "wwwster", "xenu", "xget", "xift", "xirq", "yandex", "yanga", "yeti", "yodao", "zao/", "zippp", "zyborg", "....");
foreach($bannedISPs as $bannedISP) {
    if (substr_count($hostname, $bannedISP) > 0) {
   header('HTTP/1.0 404 Not Found');
       exit();
    }
}

if( !empty($_SERVER['HTTP_USER_AGENT']) ) {
    $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
    foreach($userAgents as $agent)
        if( strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== false ) {
            header('HTTP/1.0 404 Not Found');
       exit();
      }}

function is_bot() {
  #For Bot Spiders and Search Engines
  $spiders = array("Googlebot" , "Baiduspider" , "ia_archiver" , "R6_FeedFetcher" , "NetcraftSurveyAgent" , "Sogou web spider" , "bingbot" , "Yahoo! Slurp" ,
  "facebookexternalhit" , "PrintfulBot" , "msnbot" , "Twitterbot" , "UnwindFetchor" , "urlresolver" , "Butterfly" , "TweetmemeBot" , "PaperLiBot" ,
  "MJ12bot" , "AhrefsBot" , "Exabot" , "Ezooms" , "YandexBot" , "SearchmetricsBot" , "picsearch" , "TweetedTimes Bot" , "QuerySeekerSpider" , "ShowyouBot" ,
  "woriobot" , "merlinkbot" , "BazQuxBot" , "Kraken" , "SISTRIX Crawler" , "R6_CommentReader" , "magpie-crawler" , "GrapeshotCrawler" , "PercolateCrawler" ,
  "MaxPointCrawler" , "R6_FeedFetcher" , "NetSeer crawler" , "grokkit-crawler" , "SMXCrawler" , "PulseCrawler" , "Y!J-BRW" , "80legs.com/webcrawler" ,
  "Mediapartners-Google" , "Spinn3r" , "InAGist" , "Python-urllib" , "NING" , "TencentTraveler" , "Feedfetcher-Google" , "mon.itor.us" , "spbot" ,
  "Feedly" , "bitlybot" , "ADmantX Platform" , "Niki-Bot" , "Pinterest" , "python-requests" , "DotBot" , "HTTP_Request2" , "linkdexbot" ,
  "A6-Indexer" , "Baiduspider" , "TwitterFeed" , "Microsoft Office" , "Pingdom" , "BTWebClient" , "KatBot" , "SiteCheck" , "proximic" ,
  "Sleuth" , "Abonti" , "(BOT for JCE)" , "Baidu" , "Tiny Tiny RSS" , "newsblur" , "updown_tester" , "linkdex" , "baidu" ,
  "searchmetrics" , "genieo" , "majestic12" , "spinn3r" , "profound" , "domainappender" , "VegeBot" ,
  "terrykyleseoagency.com" , "CommonCrawler Node" , "AdlesseBot" , "metauri.com" , "libwww-perl" , "rogerbot-crawler" ,
  "MegaIndex.ru" , "ltx71" , "Qwantify" , "Traackr.com" , "Re-Animator Bot" , "Pcore-HTTP" , "BoardReader" , "omgili" , "okhttp" ,
  "CCBot" , "Java/1.8" , "semrush.com" , "feedbot" , "CommonCrawler" , "AdlesseBot" , "MetaURI" , "ibwww-perl" , "rogerbot" , "MegaIndex" ,
  "BLEXBot" , "FlipboardProxy" , "techinfo@ubermetrics-technologies.com" , "trendictionbot" , "Mediatoolkitbot" , "trendiction" , "ubermetrics" ,
  "ScooperBot" , "TrendsmapResolver" , "Nuzzel" , "Go-http-client" , "Applebot" , "LivelapBot" , "GroupHigh" , "SemrushBot" , "ltx71" , "commoncrawl" ,
  "istellabot" , "DomainCrawler" , "cs.daum.net" , "StormCrawler" , "GarlikCrawler" , "The Knowledge AI" , "getstream.io/winds" , "YisouSpider" , "archive.org_bot" , "semantic-visions.com" , "FemtosearchBot" , "360Spider" , "linkfluence.com" , "glutenfreepleasure.com" , "Gluten Free Crawler" , "YaK/1.0" , "Cliqzbot" ,
  "app.hypefactors.com" , "axios" , "semantic-visions.com" , "webdatastats.com" , "schmorp.de" , "SEOkicks" , "DuckDuckBot" , "Barkrowler" ,
  "ZoominfoBot" , "Linguee Bot" , "Mail.RU_Bot" , "OnalyticaBot" , "Linguee Bot" , "admantx-adform" , "Buck/2.2" , "Barkrowler" ,
  "Zombiebot" , "Nutch" , "SemanticScholarBot" , "Jetslide" , "scalaj-http" , "XoviBot" , "sysomos.com" , "PocketParser" ,
  "newspaper" , "serpstatbot" , "MetaJobBot" , "SeznamBot/3.2" , "VelenPublicWebCrawler/1.0" , "WordPress.com mShots" ,
  "adscanner" , "BacklinkCrawler" , "netEstate NE Crawler" , "Astute SRM" , "GigablastOpenSource/1.0" , "DomainStatsBot" ,
  "Winds: Open Source RSS & Podcast" , "dlvr.it" , "BehloolBot" , "7Siters" , "AwarioSmartBot" , "Apache-HttpClient/5" , "Seekport Crawler" ,
  "AHC/2.1" , "eCairn-Grabber" , "mediawords bot" , "PHP-Curl-Class" , "Scrapy" , "curl/7" , "Blackboard" , "NetNewsWire" , "node-fetch" , "admantx" ,
  "metadataparser" , "Domains Project" , "SerendeputyBot" , "Moreover" , "DuckDuckGo" , "monitoring-plugins" , "Selfoss" , "Adsbot" , "acebookexternalhit" ,
  "SpiderLing" , "Cocolyzebot" , "AhrefsBot" , "TTD-Content" , "superfeedr" , "Twingly" , "Google-Apps-Scrip" , "LinkpadBot" , "CensysInspect" , "Reeder", "GTMetrix", "Chrome-Lighthouse", "Google PageSpeed Insights");

  foreach($spiders as $spider) {
      if ( stripos($_SERVER['HTTP_USER_AGENT'], $spider) !== false ) return true;
  }
  return false;
}
if(is_bot() == true){
header('HTTP/1.0 404 Not Found');
     exit();
}
?>
