Rate this script:  I Love it  /   I Hate it

get_browser_


Code


function get_browser_($user_agent)
{
        $browsers = array(
                'Opera' => 'Opera',
                'Mozilla Firefox'=> '(Firebird)|(Firefox)',
                'Galeon' => 'Galeon',
                'Mozilla'=>'Gecko',
                'MyIE'=>'MyIE',
                'Lynx' => 'Lynx',
                'Netscape' => '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)',
                'Konqueror'=>'Konqueror',
                'SearchBot' => '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)',
                'Internet Explorer 6' => '(MSIE 6\.[0-9]+)',
                'Internet Explorer 5' => '(MSIE 5\.[0-9]+)',
                'Internet Explorer 4' => '(MSIE 4\.[0-9]+)',
        );

        foreach($browsers as $browser=>$pattern)
        {
                if (eregi($pattern, $user_agent))
                        return $browser;
        }
        return 'Unknown';
}
echo get_browser_($_SERVER['HTTP_USER_AGENT']);

 

 
get_browser_ scripts | get_browser_ snippet | get_browser_ example | get_browser_ tutorial | get_browser_ code