You are here: Re: finding operating system using php « All PHP « IT news, forums, messages
Re: finding operating system using php

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация