In the PHP manual http://us2.php.net/manual/en/reserved.variables.php
Somewhere there, you can find information on getting the Operating System, etc. there.
Here's a snippet:
HTTP_USER_AGENT
Contents of the User_Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is: Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Among other things, you can use this value with get_browser() to tailor your page's output to the capabilities of the user agent.
Then you can whip up whatever type of script you would like.