Определитель браузера
<?php
#| uaid ( string($agent), bool($returnver) );
function uaid($agent, $returnver)
{
$arbuz=strtok($agent, "/");
$tmp1 = explode("/", $agent);
if($tmp1[2] != 'MIDP; Opera Mini')
{
$verid = $tmp1[(count($tmp1)-2)];
$tmp2 = explode(" ", $verid);
$browser_f = $tmp2[(count($tmp2)-1)];
if($returnver) {
$verver = str_replace('-', '', preg_replace("/[A-z]/i", '', $tmp1[(count($tmp1)-1)]));
$tmp3 = $browser_f.'/'.$verver;
}
else {
$tmp3 = $browser_f;
}
if( strlen(str_replace('Chrome', '', $tmp1[2]))<strlen($tmp1[2]) )
{
$arbuz = 'Google Chrome';
}
$tmp3 = preg_replace("/\((.*)\)/i", '', $tmp3);
$browser_full = trim($arbuz.' '.str_replace(array('Version', '/', 'Configuration', 'CLDC-1.0', 'CLDC-1.1', 'CLDC-2.0', 'CLDC-2.1', 'CLDC', 'Profile'), ' ', $tmp3));
$mozillabug = array('Trident', '4.0)', 'b4pre', 'KHTML', 'Dillo Dillo');
$realreplace = array('Internet Explorer', '8.0', '', 'Konqueror', 'Dillo');
$browser_full = str_replace($mozillabug, $realreplace, $browser_full);
if( (strlen(str_replace('Mozilla', '', $browser_full))<strlen($browser_full)) && (strlen(str_replace('Firefox', '', $browser_full))==strlen($browser_full)) )
{
$browser_full = str_replace('Mozilla ', '', $browser_full);
}
if($arbuz=='Google Chrome')
{
$browser_full = str_replace('Safari', '', $browser_full);
}
}
else
{
if($returnver) {
$browser_full = trim('Opera Mini '.$tmp1[3]);
}
else {
$browser_full = 'Opera Mini';
}
}
return $browser_full;
}
$ua = htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES);
echo 'Ваш браузер с версией: ',uaid($ua, true),
'<br>Без версии: ',uaid($ua, false);
?>