<?php
if (!defined('NTLCMS')) die('<center><b>Restricted access</b></center>');			

class USER_INFO {
private $_ua            = null;
private $_searchEngine  = false;
private $_mobileBrowser = false;
private $_name          = null;
private $_type          = null;
private $_os            = null;
private $_os_build      = null;
private $_code          = null;

    
/* Строка формата HTTP_USER_AGENT */
public function __construct($ua = null){
$this -> _ua = ($ua === null) ? filter_var($_SERVER['HTTP_USER_AGENT'], FILTER_SANITIZE_STRING) : $ua;
}
    
/* Строка формата HTTP_USER_AGENT */
public function getUserAgent(){
return $this -> _ua;
}
    
/* Кодовое название браузера */
public function getCode(){
$agent = $this -> _ua;
$agent = strtok($agent, '( ');
$this -> _code = str_replace('/', ' ', $agent);
return $this -> _code;
}
    
/* Тип "браузера"
0 - неопознано,
1 - клиентский,
2- мобильный,
3 - поисковик */
public function getType(){
if ($this -> _type === null){
$this -> getUserAgentName();
if ($this -> _searchEngine){
$this -> _type = 3;
} else {
$this -> getOS();
if ($this -> _mobileBrowser){
$this -> _type = 2;
} else {
$this -> _type = 1;
}
}
}
return $this -> _type;
}
    
    
/* Имя браузера клиента */
public function getUserAgentName(){
if ($this -> _name === null){
$this -> _checkUA($this -> _ua);
}
return $this -> _name;
}
    
/* Имя ОС клиента */
public function getOS(){
if ($this -> _os === null){
$this -> _checkOS($this -> _ua);
}
return $this -> _os;
}
    
/* Версия ОС клиента */
public function getOSBuild(){
if ($this -> _os_build === null){
$this -> _checkOS($this -> _ua);
}
return $this -> _os_build;
}

/* Обрезаем строку с условием */	
public function subtok($string,$chr,$pos,$len = NULL){
return implode($chr, array_slice(explode($chr, $string), $pos, $len));
}
    
private function _checkOS($ua){ 

if (preg_match('/AmigaOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Amiga.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' AmigaOS';
if (preg_match('/AmigaOS\ ([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/Android/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Android.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Android';
$this -> _mobileBrowser = true;
if (preg_match('/Android\ ([.0-9]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/[^A-Za-z]Arch/i', $ua)){ //&& !preg_match('/Search/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Arch.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Arch Linux';
} elseif(preg_match('/BeOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Beos.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' BeOS';
} elseif(preg_match('/CentOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/CentOS.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' CentOS';
if (preg_match('/.el([.0-9a-zA-Z]+).centos/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/CrOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Chromeos.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Google Chrome OS';
} elseif(preg_match('/Debian/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Debian.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Debian GNU/Linux';
} elseif(preg_match('/DragonFly/i', $ua)){
$icon = '<img src="'.URL.'/style/os/DragonFly.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' DragonFly BSD';
} elseif(preg_match('/Edubuntu/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Edubuntu.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Edubuntu';
if (preg_match('/Edubuntu[\/|\ ]([.0-9a-zA-Z]+)/i', $ua, $pocket))
$version.= ' '.$pocket['1'];
if (strlen($version) > 1)
$this -> _os.= $version;
} elseif(preg_match('/Fedora/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Fedora.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Fedora';
if (preg_match('/.fc([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/Foresight\ Linux/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Foresight.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Foresight Linux';
if (preg_match('/Foresight\ Linux\/([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/FreeBSD/i', $ua)){
$icon = '<img src="'.URL.'/style/os/FreeBSD.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' FreeBSD';
} elseif(preg_match('/Gentoo/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Gentoo.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Gentoo';
} elseif(preg_match('/IRIX/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Irix.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' IRIX Linux';
if (preg_match('/IRIX(64)?\ ([.0-9a-zA-Z]+)/i', $ua, $pocket)){
if ($pocket['1'])
$this -> _os.= ' x'.$pocket['1'];
if ($pocket['2'])
$this -> _os.= ' '.$pocket['2'];
}
} elseif(preg_match('/Kanotix/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Kanotix.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Kanotix';
} elseif(preg_match('/Knoppix/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Knoppix.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Knoppix';
} elseif(preg_match('/Kubuntu/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Kubuntu.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Kubuntu';
if (preg_match('/Kubuntu[\/|\ ]([.0-9a-zA-Z]+)/i', $ua, $pocket))
$version.= ' '.$pocket['1'];
if (strlen($version) > 1)
$this -> _os.= $version;
} elseif(preg_match('/LindowsOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Lindows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' LindowsOS';
} elseif(preg_match('/Linspire/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Unknown.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Linspire';
} elseif(preg_match('/Linux\ Mint/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Mint.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Linux Mint';
if (preg_match('/Linux\ Mint\/([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/Lubuntu/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Lubuntu.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Lubuntu';
if (preg_match('/Lubuntu[\/|\ ]([.0-9a-zA-Z]+)/i', $ua, $pocket))
$version.= ' '.$pocket['1'];
if (strlen($version) > 1)
$this -> _os.= $version;
} elseif(preg_match('/Mac/i', $ua) || preg_match('/Darwin/i', $ua)){
if (preg_match('/Mac OS X/i', $ua)){
$this -> _os = substr($ua, strpos(strtolower($ua), strtolower('Mac OS X')));
$this -> _os = substr($this -> _os, 0, strpos($this -> _os, ';'));
$this -> _os = str_replace('_', '.', $this -> _os); 
} elseif(preg_match('/Mac OSX/i', $ua)){
$this -> _os = substr($ua, strpos(strtolower($ua), strtolower('Mac OSX')));
$this -> _os = substr($this -> _os, 0, strpos($this -> _os, ';'));
$this -> _os = str_replace('_', '.', $this -> _os); 
} elseif(preg_match('/Darwin/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Darwin.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Mac OS Darwin';
} else {
$icon = '<img src="'.URL.'/style/os/Mac.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Macintosh';
}
} elseif(preg_match('/Mandriva/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Mandriva.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Mandriva';
if (preg_match('/mdv([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/MorphOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Morph.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' MorphOS';
} elseif(preg_match('/NetBSD/i', $ua)){
$icon = '<img src="'.URL.'/style/os/NetBSD.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' NetBSD';
} elseif(preg_match('/OpenBSD/i', $ua)){
$icon = '<img src="'.URL.'/style/os/OpenBSD.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' OpenBSD';
} elseif(preg_match('/Oracle/i', $ua)){
$icon = '<img src="'.URL.'/style/icons/os/Oracle.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Oracle';
if (preg_match('/.el([._0-9a-zA-Z]+)/i', $ua, $pocket))

$this -> _os.= ' Enterprise Linux '.str_replace('_', '.', $pocket['1']);
else
$icon = '<img src="'.URL.'/style/os/Linux.png" width = "16" height = "16" alt = "*"/>';
$this -> _os.= $icon.' Linux';
} elseif(preg_match('/PCLinuxOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/PCLinuxOS.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' PCLinuxOS';
if (preg_match('/PCLinuxOS\/[.\-0-9a-zA-Z]+pclos([.\-0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.str_replace('_', '.', $pocket['1']);
} elseif(preg_match('/Red\ Hat/i', $ua) || preg_match('/RedHat/i', $ua)){
$icon = '<img src="'.URL.'/style/os/RedHat.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Red Hat';
if (preg_match('/.el([._0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' Enterprise Linux '.str_replace('_', '.', $pocket['1']);
} elseif(preg_match('/Sabayon/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Sabayon.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Sabayon Linux';
} elseif(preg_match('/Slackware/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Slackware.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Slackware';
} elseif(preg_match('/Solaris/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Solaris.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Solaris';
} elseif(preg_match('/SunOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/SunOS.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' SunOS';
} elseif(preg_match('/Suse/i', $ua)){
$icon = '<img src="'.URL.'/style/os/SUSE.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' openSUSE';
} elseif(preg_match('/Symb[ian]?[OS]?/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Symbian.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Symbian OS';
$this -> _mobileBrowser = true;
if (preg_match('/Symb[ian]?[OS]?\/([.0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/Ubuntu/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Ubuntu.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Ubuntu';
if (preg_match('/Ubuntu[\/|\ ]([.0-9a-zA-Z]+)/i', $ua, $pocket))
$version.= ' '.$pocket['1'];
if (strlen($version) > 1)
$this -> _os.= $version;
} elseif(preg_match('/Unix/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Unix.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Unix';
} elseif(preg_match('/VectorLinux/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Vector.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' VectorLinux';
} elseif(preg_match('/Venenux/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Venenux.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Venenux GNU Linux';
} elseif(preg_match('/webOS/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Unknown.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Palm webOS';
} elseif(preg_match('/Windows NT 10.0/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 10';
} elseif(preg_match('/Windows NT 6.3/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 8.1';
} elseif(preg_match('/Windows NT 6.2/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Win8.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 8';
} elseif(preg_match('/Windows/i', $ua) || preg_match('/WinNT/i', $ua) || preg_match('/Win32/i', $ua)){
if (preg_match('/Windows NT 6.1; Win64; x64;/i', $ua) || preg_match('/Windows NT 6.1; WOW64;/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 7 x64 Edition';
} elseif(preg_match('/Windows NT 6.1/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 7';
} elseif(preg_match('/Windows NT 6.0/i', $ua)){
$icon = '<img src="'.URL.'/style/os/WinVista.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Vista';
} elseif(preg_match('/Windows NT 5.2 x64/i', $ua)){
$icon = '<img src="'.URL.'/style/os/WinXP.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows XP x64 Edition';
} elseif(preg_match('/Windows NT 5.2/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Server 2003';
} elseif(preg_match('/Windows NT 5.1/i', $ua) || preg_match('/Windows XP/i', $ua)){
$icon = '<img src="'.URL.'/style/os/WinXP.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows XP';
} elseif(preg_match('/Windows NT 5.01/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Win2000.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 2000, Service Pack 1 (SP1)';
} elseif(preg_match('/Windows NT 5.0/i', $ua) || preg_match('/Windows 2000/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Win2000.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 2000';
} elseif(preg_match('/Windows NT 4.0/i', $ua) || preg_match('/WinNT4.0/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Microsoft Windows NT 4.0';
} elseif(preg_match('/Windows NT 3.51/i', $ua) || preg_match('/WinNT3.51/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Microsoft Windows NT 3.51';
} elseif(preg_match('/Windows 3.11/i', $ua) || preg_match('/Win3.11/i', $ua) || preg_match('/Win16/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Microsoft Windows 3.11';
} elseif(preg_match('/Windows 3.1/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Microsoft Windows 3.1';
} elseif(preg_match('/Windows 98; Win 9x 4.90/i', $ua) || preg_match('/Win 9x 4.90/i', $ua) || preg_match('/Windows ME/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Millennium Edition (Windows Me)';
} elseif(preg_match('/Win98/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = 'Windows 98 SE';
} elseif(preg_match('/Windows 98/i', $ua) || preg_match('/Windows\ 4.10/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 98';
} elseif(preg_match('/Windows 95/i', $ua) || preg_match('/Win95/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows 95';
} elseif(preg_match('/Windows CE/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows CE';
$this -> _mobileBrowser = true;
} elseif(preg_match('/WM5/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Mobile 5';
} elseif(preg_match('/Windows Phone/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Winphone.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Phone';
if (preg_match('/Windows Phone\ ([.0-9]+)/i', $ua, $pocket) || preg_match('/Windows Phone OS\ ([.0-9]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];
} elseif(preg_match('/WindowsMobile/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows Mobile';
$this -> _mobileBrowser = true;
} else {
$icon = '<img src="'.URL.'/style/os/Windows.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Windows OS';
}
} elseif(preg_match('/Xandros/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Xandros.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Xandros';
} elseif(preg_match('/Xubuntu/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Xubuntu.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Xubuntu';
if (preg_match('/Xubuntu[\/|\ ]([.0-9a-zA-Z]+)/i', $ua, $pocket))
$version.= ' '.$pocket['1'];
if (strlen($version) > 1)
$this -> _os.= $version;
} elseif(preg_match('/Zenwalk/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Zenwalk.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Zenwalk GNU Linux';
} elseif(preg_match('/Linux/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Linux.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' GNU/Linux';
if (preg_match('/x86_64/i', $ua))
$this -> _os.= ' x64';
} elseif(preg_match('/J2ME\/MIDP/i', $ua) || preg_match('/CLDC/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Java.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' J2ME/MIDP Device';
$this -> _mobileBrowser = true;
} elseif(preg_match('/MAUI Runtime/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Unknown.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' MAUI based Platform';
$this -> _mobileBrowser = true;
} elseif(preg_match('/iPhone/i', $ua)){
$icon = '<img src="'.URL.'/style/os/Unknown.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' iPhone OS';
$this -> _mobileBrowser = true;
if (preg_match('/iPhone ([._0-9a-zA-Z]+)/i', $ua, $pocket))
$this -> _os.= ' '.$pocket['1'];




} else {
$icon = '<img src="'.URL.'/style/os/Unknown.png" width = "16" height = "16" alt = "*"/>';
$this -> _os = $icon.' Unknown';//NULL;
}
$this -> _os;
}

    
    
private function _checkUA($ua){
if (preg_match('#Googlebot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Googlebot '.$pocket['1'];    
} elseif(preg_match('#Googlebot-Mobile/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Googlebot Mobile '.$pocket['1'];
} elseif(preg_match('#Googlebot-News#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Googlebot News';
} elseif(preg_match('#Googlebot-Image/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Googlebot Image '.$pocket['1'];
} elseif(preg_match('#Googlebot-Video/([0-9]+\.[0-9]+)#i', $ua, $match)){
$this -> _searchEngine  = true;
$this -> _name = 'Googlebot Video '.$match['1'];
} elseif(preg_match('#Mediapartners-Google/([0-9]+\.[0-9]+)#i', $ua, $match)){
$this -> _searchEngine  = true;
$this -> _name = 'Google Mobile AdSense '.$match['1'];
} elseif(preg_match('#Mediapartners-Google/([0-9]+\.[0-9]+)#i', $ua, $match)){
$this -> _searchEngine  = true;
$this -> _name = 'Google AdSense';
} elseif(preg_match('#AdsBot-Google#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Google AdsBot';
} elseif(preg_match('#AdsBot-Google-Mobile-Apps#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Google Mobile Apps';
} elseif(preg_match('#AppEngine-Google#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'AppEngine Google';
} elseif(preg_match('#YandexBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Bot '.$pocket['1'];
} elseif(preg_match('#YandexAccessibilityBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Accessibility Bot '.$pocket['1'];
} elseif(preg_match('#YandexMobileBot#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Mobile Bot';
} elseif(preg_match('#YandexDirectDyn/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Direct Dyn '.$pocket['1'];
} elseif(preg_match('#YandexScreenshotBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Screenshot Bot '.$pocket['1'];
} elseif(preg_match('#YandexImages/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Images '.$pocket['1'];
} elseif(preg_match('#YandexVideo/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Video '.$pocket['1'];
} elseif(preg_match('#YandexVideoParser/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Video Parser '.$pocket['1'];
} elseif(preg_match('#YandexMedia/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Media '.$pocket['1'];
} elseif(preg_match('#YandexBlogs/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Blogs '.$pocket['1'];
} elseif(preg_match('#YandexFavicons/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Favicons '.$pocket['1'];
} elseif(preg_match('#YandexWebmaster/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Webmaster '.$pocket['1'];
} elseif(preg_match('#YandexPagechecker/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Pagechecker '.$pocket['1'];
} elseif(preg_match('#YandexImageResizer/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Image Resizer '.$pocket['1'];
} elseif(preg_match('#YandexAdNet/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex AdNet '.$pocket['1'];
} elseif(preg_match('#YandexDirect/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Direct '.$pocket['1'];
} elseif(preg_match('#YaDirectFetcher/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Direct Fetcher '.$pocket['1'];
} elseif(preg_match('#YandexCalendar/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Calendar '.$pocket['1'];
} elseif(preg_match('#YandexSitelinks#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Site links';
} elseif(preg_match('#YandexMetrika/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Metrika '.$pocket['1'];
} elseif(preg_match('#YandexNewslinks#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex News links';
} elseif(preg_match('#YandexCatalog/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Catalog '.$pocket['1'];
} elseif(preg_match('#YandexAntivirus/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Antivirus '.$pocket['1'];
} elseif(preg_match('#YandexMarket/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Market 1.0';
} elseif(preg_match('#YandexVertis/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Vertis '.$pocket['1'];
} elseif(preg_match('#YandexForDomain/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex For Domain '.$pocket['1'];
} elseif(preg_match('#MirrorDetector/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Mirror Detector '.$pocket['1'];
} elseif(preg_match('#YandexSpravBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Sprav Bot '.$pocket['1'];
} elseif(preg_match('#YandexSearchShop/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Search Shop '.$pocket['1'];
} elseif(preg_match('#YandexMedianaBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex Mediana Bot '.$pocket['1'];
} elseif(preg_match('#YandexOntoDB/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex On to DB '.$pocket['1'];
} elseif(preg_match('#YandexOntoDBAPI/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Yandex On to DB API '.$pocket['1'];
} elseif(preg_match('#StackRambler/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Rambler '.$pocket['1'];
} elseif(preg_match('#Mail.Ru/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Mail.Ru '.$pocket['1'];
} elseif(preg_match('#msnbot#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'MSN Bot';
} elseif(preg_match('#almaden#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'IBM Almaden Crawler';
} elseif(preg_match('#BecomeBot#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Become Bot';
} elseif(preg_match('#Link-Checker-Pro#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Link Checker Pro';
} elseif(preg_match('#ia_archiver#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Alexa Bot';
} elseif(preg_match('#surveybot#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Survey Bot';
} elseif(preg_match('#zyborg#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'ZyBorg';
} elseif(preg_match('#w3c-checklink#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'W3C Checklink';
} elseif(preg_match('#linkwalker#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'LinkWalker';
} elseif(preg_match('#fast-webcrawler#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Fast WebCrawler';
} elseif(preg_match('#mj12bot/v([0-9]+\.[0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'MJ12Bot '.$pocket['1'];
} elseif(preg_match('#w3c_validator#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'W3C Validator';
} elseif(preg_match('#yahoo#i', $ua) || preg_match('#slurp#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'Yahoo! Slurp';
} elseif(preg_match('#Baiduspider/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Baiduspider '.$pocket['1'];
} elseif(preg_match('#curl#i', $ua)){
$this -> _searchEngine  = true;
$this -> _name = 'libCURL';
} elseif(preg_match('#bingbot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Bingbot '.$pocket['1'];
} elseif(preg_match('#DotBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'DotBot '.$pocket['1'];
} elseif(preg_match('#OdklBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'OK.RU Bot '.$pocket['1'];
} elseif(preg_match('#SemrushBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Semrush Bot '.$pocket['1'];
} elseif(preg_match('#AhrefsBot/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _searchEngine  = true;
$this -> _name = 'Ahrefs Bot '.$pocket['1'];
            

/*} elseif(preg_match('#MSIE ([0-9]+)#ui', $ua, $bv)){
$this -> _name = 'Microsoft Internet Explorer';
$this -> ie = $bv[1];*/            
} elseif (preg_match('#MSIE ([0-9a-z\.]*)#i', $ua, $pocket)){
$this -> _name = 'IE '.self::subtok($pocket[1], '.', 0, 2);
} elseif (preg_match('#(Maxthon|NetCaptor)( [0-9a-z\.]*)?#i', $ua, $pocket)){
$this -> _name = $pocket[1] . $pocket[2];
          


            
} elseif(preg_match('#America Online Browser#i', $ua)){
$this -> _name = 'AOL Explorer';
} elseif(preg_match('#(Avant|Advanced) Browser#i', $ua)){
$this -> _name = 'Avant Browser';
} elseif(preg_match('#Camino/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Camino '.$pocket[1];
} elseif(preg_match('#ELinks#i', $ua)){
$this -> _name = 'ELinks';
} elseif(preg_match('#Epiphany#i', $ua)){
$this -> _name = 'Epiphany';
} elseif(preg_match('#Flock#i', $ua)){
$this -> _name = 'Flock';
} elseif(preg_match('#IceWeasel#i', $ua)){
$this -> _name = 'GNU IceWeasel';
} elseif(preg_match('#Microsoft Pocket Internet Explorer#i', $ua)){
$this -> _name = 'Internet Explorer Mobile';
} elseif(preg_match('#MSPIE#i', $ua)){
$this -> _name = 'Internet Explorer Mobile';
} elseif(preg_match('#Windows.+Smartphone#i', $ua)){
$this -> _name = 'Internet Explorer Mobile';
} elseif(preg_match('#Konqueror#i', $ua)){
$this -> _name = 'Konqueror';
} elseif(preg_match('#Links#i', $ua)){
$this -> _name = 'Links';
} elseif(preg_match('#Lynx/([0-9a-z\.]*)#i', $ua, $pocket)){
$this -> _name = 'Lynx '.self::subtok($pocket[1], '.', 0, 2);
} elseif(preg_match('#Minimo#i', $ua)){
$this -> _name = 'Minimo';
} elseif(preg_match('#(Firebird|Phoenix|Firefox)/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Mozilla Firefox '.$pocket[2];
} elseif(preg_match('#NetPositive#i', $ua)){
$this -> _name = 'NetPositive';
//} elseif(preg_match('#Opera/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
//if (preg_match('#Version/([0-9]+(\.[0-9]+)?)#i', $ua, $ver))
//$this -> _name = 'Opera '.($ver[1] ? $ver[1] : $pocket[1]);           
} elseif(preg_match('#Opera Mini/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Opera Mini '.$pocket[1];
} elseif (preg_match('#Opera Mobi#i', $ua)){
if (preg_match('#Version/([0-9]+(\.[0-9]+)?)#i', $ua, $ver))
$this -> _name = 'Opera Mobile '.($ver[1] ? ' '.$ver[1] : '');
} elseif (preg_match('#(SymbOS|Symbian).+Opera ([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Opera Mobile '.$pocket[2].' [Symbian]';
} elseif (preg_match('#Windows CE.+Opera ([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Opera Mobile '.$pocket[1].' [Win]';
} elseif(preg_match('#PlayStation Portable#i', $ua)){
$this -> _name = 'PlayStation Portable';
//} elseif(preg_match('#Safari#i', $ua)){
//$this -> _name = 'Safari';
} elseif(preg_match('#SeaMonkey#i', $ua)){
$this -> _name = 'SeaMonkey';
} elseif(preg_match('#Shiira#i', $ua)){
$this -> _name = 'Shiira';
} elseif(preg_match('#w3m#i', $ua)){
$this -> _name = 'w3m';
} elseif(preg_match('#Chrome/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Google Chrome '.$pocket[1];
//} elseif(preg_match('#(YaBrowser|Yowse)/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
//$this -> _name = 'Ya Browser '.$pocket[1];
//} elseif (preg_match('#(NetFront|K-Meleon|Netscape|Galeon|Epiphany|Konqueror|Safari|Opera Mini|Opera Mobile/Opera Mobi)/([0-9a-z\.]*)#i', $agent, $pocket)){
//$this -> _name = $pocket[1].' '.$pocket[2];
} elseif(preg_match('#Iron/([0-9a-z\.]*)#i', $ua, $pocket)){
$this -> _name = 'SRWare Iron '.self::subtok($pocket[1], '.', 0, 2);
} elseif (preg_match('#Orca/([ 0-9a-z\.]*)#i', $ua, $pocket)){
$this -> _name = 'Orca '.self::subtok($pocket[1], '.', 0, 2);
} elseif (preg_match('#rv:([0-9a-z\.]*)#i', $ua, $pocket) && preg_match('#Mozilla#i', $ua)){
$this -> _name = 'Mozilla '.subtok($pocket[1], '.', 0, 2);

//} elseif (preg_match('#Nokia([0-9a-z\.\-\_]*)#i', $ua, $pocket)){
//$this -> _name = 'Nokia '.$pocket[1];
} elseif (preg_match('#Mobile Safari/([ 0-9a-z\.]*)#i', $ua, $pocket)){
$this -> _name = 'Mobile Safari '.$pocket[1];
} elseif (preg_match('#UCBrowser/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'UC Browser '.$pocket[1];
} elseif (preg_match('#SamsungBrowser/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'Samsung Browser '.$pocket[1];
} elseif (preg_match('#UP\.Browser\/([0-9a-zA-Z\.]+)#i', $ua, $pocket) && preg_match('#UP\/([0-9a-zA-Z\.]+)#i', $ua, $pocket)){
$this -> _name = 'Openwave '.$pocket[1];





} elseif(preg_match('#SONY/COM#i', $ua)){
$this -> _name = 'Sony mylo';
} elseif(preg_match('#Nitro#i', $ua)){
$this -> _name = 'Nintendo DS';
} elseif(preg_match('#^Openwave#i', $ua)){
$this -> _name = 'Openwave';
} elseif(preg_match('#UCWEB/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'UCWEB '.$pocket[1];
} elseif(preg_match('#BOLT/([0-9]+\.[0-9]+)#i', $ua, $pocket)){
$this -> _name = 'BOLT '.$pocket[1];
} elseif(preg_match('#iPhone#i', $ua)){
$this -> _name = 'iPhone';
} elseif(preg_match('#iPod#i', $ua)){
$this -> _name = 'iPod';
} elseif(preg_match('#iPad#i', $ua)){
$this -> _name = 'iPad';
} elseif(preg_match('#Bada#i', $ua)){
$this -> _name = 'Samsung Bada';
} elseif(preg_match('#Android#i', $ua)){
$this -> _name = 'Android';
} elseif(preg_match('#Windows Phone#i', $ua)){
$this -> _name = 'Windows Phone 7';
} else {
$this -> _searchEngine  = false;
$this -> _name = '[undefined] '.$ua;
}
}
}

/* include ('INFO.class.php');
$info = new USER_INFO() or die('Error init USER_INFO class!');
Юзер-агент $info -> getUserAgent()
Тип браузера $info -> getType()
Имя браузера $info -> getUserAgentName()
ОС клиента $info -> getOS()
Код браузера $info -> getCode() */




?>