<?php
/*
class AutomaticBrowsersDetect 0.1 by Roberto Aleman, you can use it with BSD Licence
Please use it, and report to hide@address.com your experience for improvement the code in the next version */
class AutomaticBrowsersDetect{
function GetBrow($ua) {
$bws = array(
'Flock' => '(Mozilla)(Gekco)(Firefox)',
'Chrome' =>'Chrome',
'Safari' =>'Safari',
'Opera' => 'Opera',
'MobileSafari'=> 'Apple', //iphone
'Opera Mini' => 'Opera Mini', //mobile phones with wap services
'Android' => 'Android', //android and nokia Nseries
'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',
'Internet Explorer 8' => '(MSIE 8\.[0-9]+)',
'Internet Explorer 7' => '(MSIE 7\.[0-9]+)',
'Internet Explorer 6' => '(MSIE 6\.[0-9]+)',
'Internet Explorer 5' => '(MSIE 5\.[0-9]+)',
'Internet Explorer 4' => '(MSIE 4\.[0-9]+)',
);
foreach($bws as $bw=>$mdl){
if (eregi($mdl, $ua))
return $bw;
}
return 'UnKnow';
}
function checkcss($brow){
$css = array(
'Flock' => 'Flock.css',
'Chrome' =>'Chrome.css',
'Safari' =>'Safari.css',
'Opera' => 'Opera.css',
'MobileSafari'=> 'Apple.css', //iphone
'Opera Mini' => 'OperaMini.css', //mobile phones with wap services
'Android' => 'Android.css', //android and nokia Nseries
'Mozilla Firefox'=> 'Firefox.css',
'Galeon' => 'Galeon.css',
'Mozilla'=>'Gecko.css',
'MyIE'=>'MyIE.css',
'Lynx' => 'Lynx.css',
'Netscape' => 'Netscape.css',
'Konqueror'=>'Konqueror.css',
'Internet Explorer 8' => 'ie8.css',
'Internet Explorer 7' => 'ie7.css',
'Internet Explorer 6' => 'ie6.css',
'Internet Explorer 5' => 'ie5.css',
'Internet Explorer 4' => 'ie4.css',
);
foreach($css as $k => $v) {
if($brow == $k){
return $v; }
}
}
function checkurl($brow)
{
$url = array(
'Flock' => 'Flock.php',
'Chrome' =>'Chrome.php',
'Safari' =>'Safari.php',
'Opera' => 'Opera.php',
'MobileSafari'=> 'Apple.php', //iphone
'Opera Mini' => 'OperaMini.php', //mobile phones with wap services
'Android' => 'Android.php', //android and nokia Nseries
'Mozilla Firefox'=> 'Firefox.php',
'Galeon' => 'Galeon.php',
'Mozilla'=>'Gecko.php',
'MyIE'=>'MyIE.php',
'Lynx' => 'Lynx.php',
'Netscape' => 'Netscape.php',
'Konqueror'=>'Konqueror.php',
'Internet Explorer 8' => 'ie8.php',
'Internet Explorer 7' => 'ie7.php',
'Internet Explorer 6' => 'ie6.php',
'Internet Explorer 5' => 'ie5.php',
'Internet Explorer 4' => 'ie4.php',
);
foreach($url as $k => $v) {
if($brow == $k){
return $v; }
}
}
}
?>