<?
function GetOS($string)
{
if(stripos($string,"windows ") != null ||
stripos($string,"winnt") != null ||
stripos($string,"win ") != null ||
preg_match("/win[0-9]{2}/i",$string))
{
preg_match("/(windows |winnt|win |win[0-9]{2})[^;)]*/i",$string,$regs);
return $regs[0];
}
if(stripos($string,"powerpc") != null ||
stripos($string,"macintosh") != null ||
stripos($string,"mac os") != null)
{
return "Macintosh";
}
if(stripos($string,"freebsd") != null ||
stripos($string,"linux") != null ||
stripos($string,"unix") != null ||
stripos($string,"lynx") != null)
{
preg_match("/(freebsd|linux|unix|lynx)[^;)-]*/i",$string,$regs);
return $regs[0];
}
return "Другие";
}
function GetBrows($string)
{
if(stripos($string,"opera") !== false)
{
preg_match("/opera[^\"(\[]*/i",$string,$regs);
return str_replace("/"," ",$regs[0]);
}
if(stripos($string,"konqueror") !== false ||
stripos($string,"safari") !== false)
{
preg_match("/(konqueror|safari)[^;)]*/i",$string,$regs);
return str_replace("/"," ",$regs[0]);
}
if(stripos($string,"gecko") !== false)
{
preg_match("/rv:([^;)]*)/i",$string,$regs);
if(stripos($string,"firefox") !== false)
$str = " (Firefox)";
elseif(stripos($string,"netscape") !== false)
$str = " (Netscape)";
return "Mozilla$str $regs[1]";
}
if(stripos($string,"myie") !== false)
{
preg_match("/myie[^;)]*/i",$string,$regs);
return str_replace("/"," ",$regs[0]);
}
if(stripos($string,"MSIE") != null)
{
preg_match("/MSIE([^;)]*)/i",$string,$regs);
return "Internet Explorer $regs[1]";
}
return "Другие";
}
?>
|