Hi Ulrik
I just wrote this a few days ago. I's based on ideas and solutions found in an article on this site by Tim Perdue (browser detection and appropriate css generation)
<?
// Determine browser and set $browser for CSS and
// $browser_temp for template generation.
$browser_str=$HTTP_USER_AGENT;
if (ereg('Opera',$browser_str)) {
$browser="opera";
$browser_temp="temp_opera.ihtml";
} elseif (ereg('MSIE',$browser_str)) {
$browser="ie";
$browser_temp="temp_ie.ihtml";
} elseif (ereg('Netscape6',$browser_str)) {
$browser="ns6";
$browser_temp="temp_ns6.ihtml";
} elseif (ereg('Mozilla/4',$browser_str)) {
$browser="ns4";
$browser_temp="temp_ns4.ihtml";
} else {
$browser="other";
$browser_temp="temp_other.ihtml";
}
// Determine platform for CSS generation.
if (strstr($browser_str,'Win')) {
$platform='Win';
} else if (strstr($browser_str,'Mac')) {
$platform='Mac';
} else if (strstr($browser_str,'Linux')) {
$platform='Linux';
} else if (strstr($browser_str,'Unix')) {
$platform='Unix';
} else {
$platform='Other';
}
?>
Just take out the bits you don't need like the $browser_temp stuff and you've got a pretty good idea of what your users are using and on what platform.
I suggest you take a look at the article I mentioned as it's very useful.
Hope this helps
Nick