Ich will für einen Statistikbereich das OS des Besuchers auslesen,
ich verwende dazu folgenden COde:
Allerdings gibt er mir (Windows XP) immer an ich nutze NT, die Ausgaben lautet bei mir:
Wo liegt mein Denkfehler?
ich verwende dazu folgenden COde:
PHP-Code:
<?php
$os_list = array("unknown" => "unbekannt",
"AmigaOS 3.0" => "AmigaOS 3.0",
"Win16" => "Windows 3.1",
"Windows NT 4.0" => "Windows NT",
"Windows NT 5.0" => "Windows 2000",
"Windows NT 5.1" => "Windows XP",
"WIndows NT" => "Windows NT",
"Windows 95" => "Windows 95",
"Windows 98" => "Windows 98",
"Windows ME" => "Windows ME",
"Windows 2000" => "Windows 2000",
"Windows XP" => "Windows XP",
"Win95" => "Windows 95",
"Win98" => "Windows 98",
"WinNT4" => "Windows NT",
"WinNT" => "Windows NT",
"Debian" => "Linux",
"HP-UX" => "HP-UX",
"SunOS" => "Sun Solaris",
"AIX" => "AIX",
"BeOS" => "BeOS",
"Linux" => "Linux",
"OpenBSD" => "OpenBSD",
"Macintosh" => "Macintosh",
"Mac_PowerPC" => "Power Mac",
"IRIX" => "IRIX",
);
$agentstring = getenv("HTTP_USER_AGENT");
preg_match("#(" . str_replace(array(".","(",")","?"),array("\.","\(","\)","\?"), implode("|", $os_list)) . ")#i", $agentstring, $matches);
if (isset($matches[1])) $system = $matches[1];
echo $system. "<br>";
echo getenv("HTTP_USER_AGENT");
?>
Code:
Windows NT Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.6) Gecko/20040113
Kommentar