PDA

View Full Version : Operating Systems script



foxpro
04-02-2006, 01:29 PM
Hello
I have a problem.
How i can write in the page the Operating Systems of the user?

Twey
04-02-2006, 02:15 PM
A good question. The OS is contained in the User-Agent header, but isn't always in the same place. You really have to do something like this:
$os = "Other";
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($ua, "linux") != -1) $os = "Linux";
if(strpos($ua, "windows") != -1) $os = "Windows";
if(strpos($ua, "apple") != -1) $os = "Mac";
if(strpos($ua, "bsd") != -1) $os = "BSD";
// ...

foxpro
04-02-2006, 02:43 PM
Thanks you