|
Posted by Steve on 04/12/06 14:24
"nescio" <nescio@nescio.nl> wrote in news:443b80d7$0$296$19deed1b@news.inter.NL.net:
> hello,
>
>
> can i find with php the operating system of a visitor to a site?
>
> if yes, how is it done
>
> (i tried phpinfo() but cannot find it there, nor in the manual)
>
> thanks
>
>
$_SERVER['HTTP_USER_AGENT']
this will give you alot of information .. like browser, os. so you have to sort out the
information. like this....
if( ereg('Win', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'Windows';
}
elseif( ereg('Mac', $_SERVER['HTTP_USER_AGENT']) || ereg('PPC', $_SERVER
['HTTP_USER_AGENT']) )
{
$os = 'Mac';
}
elseif( ereg('Linux', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'Linux';
}
elseif( ereg('FreeBSD', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'FreeBSD';
}
elseif( ereg('SunOS', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'SunOS';
}
elseif( ereg('IRIX', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'IRIX';
}
elseif( ereg('BeOS', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'BeOS';
}
elseif( ereg('OS/2', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'OS/2';
}
elseif( ereg('AIX', $_SERVER['HTTP_USER_AGENT']) )
{
$os = 'AIX';
}
else
{
$os = 'Other';
}
you can then use tha var $os for whatever purpose you like.
hope that helps.
-------------
Get FREE newsgroup access from http://www.cheap56k.com
Navigation:
[Reply to this message]
|