Location: PHPKode > scripts > Visitor Logger > browser.txt
<?php

$VL_UserAgent = $_SERVER['HTTP_USER_AGENT'];
if (!$VL_UserAgent) $VL_UserAgent = "Unknown";
else $VL_UserAgent = strtolower($VL_UserAgent);

$VL_botlist = array("teoma", "alexa", "froogle", "inktomi", "looksmart", "firefly", "nationaldirectory", "ask", "technoseek", "infoseek", "www.galaxy.com", "googlebot", "google webmaster", "scooter", "slurp", "msnbot", "appie", "fast", "webbug", "spade", "zyborg", "rabaz", "feedfetcher-google", "technoratisnoop", "mediapartners-google", "spider", "crawler", "bot", "crawl", "theplanet.com", "as13448.com");

if (($VL_host != "Unknown") OR ($VL_UserAgent != "Unknown")) { 
	foreach($VL_botlist as $VL_bot) {
	if (stristr($VL_UserAgent.$VL_host, $VL_bot)) $VL_browser = "Bot";
	}
}
else $VL_browser = "Unknown";

if ($VL_browser == "Bot") {
	if (stristr($VL_UserAgent.$VL_host, 'google')) $VL_browser = "Google Bot";
	else
	if (stristr($VL_UserAgent.$VL_host, 'slurp')) $VL_browser = "Yahoo Bot";
	else
	if (stristr($VL_UserAgent.$VL_host, 'yahoo')) $VL_browser = "Yahoo Bot";
	else
	if (stristr($VL_UserAgent.$VL_host, 'ask')) $VL_browser = "Ask Jeeves Bot";
	else
	if (stristr($VL_UserAgent.$VL_host, 'msn')) $VL_browser = "MSN Bot";
	else
	if (stristr($VL_UserAgent.$VL_host, 'bing')) $VL_browser = "Bing Bot";
}

if (!$VL_browser) {
	if (stristr($VL_UserAgent, 'chrome')) $VL_browser = "Google Chrome";
	else
	if (stristr($VL_UserAgent, 'safari')) $VL_browser = "Apple Safari";
	else
	if (stristr($VL_UserAgent, 'opera')) $VL_browser = "Opera";
	else
	if (stristr($VL_UserAgent, 'seamonkey')) $VL_browser = "Mozilla SeaMonkey";
	else
	if ((stristr($VL_UserAgent, 'netscape')) or (stristr($VL_UserAgent, 'navigator'))) $VL_browser = "Netscape Navigator";
	else
	if (stristr($VL_UserAgent, 'firefox')) $VL_browser = "Mozilla Firefox";
	else
	if (stristr($VL_UserAgent, 'msie')) $VL_browser = "Internet Explorer";
	else
	if (stristr($VL_UserAgent, 'mozilla')) $VL_browser = "Mozilla";
	else
	$VL_browser = "Unknown";
}

?>
Return current item: Visitor Logger