1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <?php function OS( $To = '' )
{
if( ! $To ) $To = $_SERVER['HTTP_USER_AGENT'];
$se = 'Système d\'exploitation meconnu';
$se_arr = Array
(
// -- Windows
'Windows NT 6.1' => 'Windows Seven',
'Windows NT 6.0' => 'Windows Vista',
'Windows NT 5.2' => 'Windows Server 2003',
'Windows NT 5.1' => 'Windows XP',
'Windows NT 5.0' => 'Windows 2000',
'Windows 2000' => 'Windows 2000',
'Windows CE' => 'Windows Mobile',
'Win 9x 4.90' => 'Windows Me.',
'Windows 98' => 'Windows 98',
'Windows 95' => 'Windows 95',
'Win95' => 'Windows 95',
'Windows NT' => 'Windows NT',
// -- Linux mon ami
'Ubuntu' => 'Linux Ubuntu',
'Fedora' => 'Linux Fedora',
'Linux' => 'Linux',
// -- Mac
'Macintosh' => 'Mac',
'Mac OS X' => 'Mac OS X',
'Mac_PowerPC' => 'Mac OS X',
// -- Autres distribution
'FreeBSD' => 'FreeBSD',
'Unix' => 'Unix',
'Playstation portable' => 'PSP',
'OpenSolaris' => 'SunOS',
'SunOS' => 'SunOS',
'Nintendo Wii' => 'Nintendo Wii',
'Mac' => 'Mac',
);
$To = strtolower( $To );
foreach( $se_arr as $a => $b )
{
if( preg_match( strtolower( $a ), $To ) ) // remplacer ereg par preg_match pour le teste
{
$se = $b;
break;
}
}
return $se;
}?> |
Partager