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

class Operatings {

var $agent = '';
var $os = '';

public function Operatings($agent){
$this -> agent = $agent;
}
		
public function OSystem(){ 

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

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

}

//$oss = new Operatings() or die('Error init Operatings class!');
//$oss = new Operatings($_SERVER['HTTP_USER_AGENT']);
//$oss -> OSystem()

?>