Вот вам код, давно писал, кому нужно берите
function get_os($user_agent)
{
$oses = array ('(Windows 95)|(Win95)|(Windows_95)', '(Windows 98)|(Win98)', '(Windows NT 5.0)|(Windows 2000)', '(Windows NT 5.1)|(Windows XP)', 'Windows NT 5.2', '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)', 'Windows ME', 'OpenBSD', 'SunOS', '(Linux)|(X11)', '(Mac_PowerPC)|(Macintosh)', 'QNX', 'BeOS', 'OS/2');
foreach($oses as $os)
{
if (eregi($os, $user_agent)) return 'PC';
}
return 'Mobile';
}
$site_ver = get_os($_SERVER['HTTP_USER_AGENT']);
if($site_ver == 'PC')
{
//WEB
}
elseif($site_ver == 'Mobile')
{
//WAP
}
?>