blob: 3c6085e779aa3c0ac71226981458db3db21d2450 [file] [log] [blame]
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Code Igniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author Rick Ellis
* @copyright Copyright (c) 2006, pMachine, Inc.
* @license http://www.codeignitor.com/user_guide/license.html
* @link http://www.codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* Code Igniter User Agent Helper
*
* @package CodeIgniter
* @subpackage Helpers
* @category Helpers
* @author Rick Ellis
* @link http://www.codeigniter.com/user_guide/helpers/array_helper.html
*/
// ------------------------------------------------------------------------
/**
* Get the OS of the user currently browsing the site
*
* @access public
* @return string
*/
function get_OS()
{
if ( ! isset($_SERVER['HTTP_USER_AGENT']))
{
return 'Unknown OS';
}
$os = array (
'windows nt 6.0' => 'Windows Longhorn',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.0' => 'Windows 2000',
'windows nt 5.1' => 'Windows XP',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows' => 'Unknown Windows OS',
'mac os x' => 'Mac OS X',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'sunos' => 'Sun Solaris',
'linux' => 'Linux',
'debian' => 'Debian',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS'
);
foreach ($os as $key => $val)
{
if (preg_match("|$key|i", $_SERVER['HTTP_USER_AGENT']))
{
return $val;
}
}
return 'Unknown OS';
}
?>