Solved

Browser and OS detection

Posted on 2006-07-12
7
1,164 Views
Last Modified: 2008-02-01
Hi guys.

I'm required to create a detailed script which will detect the users browser and general pc settings and i would greatly appriciate any advise and code snippets what you may be able to share with me.

I'm developing in PHP.

I'm trying to detect the following in relation to Broswers:
Browser Name (pretty straight forward)
Browser Version (straight forward)
Brower Plugins
Flash Version
Screen Resolution (i have done this already)
If cookies are enabled/disabled
If Javascript is enabled
(Any other important browser setting that i should attempt to detect that you may suggest?)

I'm just using:
[php]
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
<?php print "IP: ". $_SERVER ['REMOTE_ADDR']; ?>
[/php]
To detect the browser name and the IP address at the moment. Is there a better method of detecting either of these? Would that code be able to detect IP addresses behind a proxy?

Operating System:
What manufacturer
What version
What service pack

Some long shots! Is it possible to detect the Make and Model of the Router been used via PHP? And also if the user is using Anti-Virus or a Firewall on their system?

Any help is greatly appriciated. Thanks.
0
Comment
Question by:blaadom
  • 4
  • 3
7 Comments
 
LVL 8

Accepted Solution

by:
Autogard earned 500 total points
ID: 17095298
>>To detect the browser name and the IP address at the moment. Is there a better method of detecting either of these?
>>Operating System:
>>What manufacturer
>>What version
>>What service pack

The best way I've seen is to use www.php.net/get_browser.  It gives you a pretty comprehensive list of attributes of your visitor.  It requires that you use the "browscap" file (mentioned in that link as well as a link to an updated one).

>>Would that code be able to detect IP addresses behind a proxy?

I don't know of a way of detecting an IP address behind a proxy because the proxy simply hides the IP of the originating user.

>>Some long shots! Is it possible to detect the Make and Model of the Router been used via PHP? And also if the user is using Anti-Virus or a Firewall on their system?

Don't know if it's possible
0
 
LVL 8

Expert Comment

by:Autogard
ID: 17095322
I should note that the "get_browser" and browscap just works from a text file that has browser specifications, so it will show you what OS, version, browser, version, etc... the user is running and it will tell you if those browsers support javascript, frames, etc... but it doesn't tell you (as far as I know) if the user actually has those capabilities enabled or not.

As for your last question -- I sure hope it's not possible to detect some of those things because it would make it real easy to spread viruses, etc...  But there are probably other ways of finding out that stuff.

Just curious, what is the use case that you have that requires you to know so much about a user? :-)
0
 

Author Comment

by:blaadom
ID: 17095360
I'm developing a website which retrives browser settings and the likes.
Something similar to http://www.showmyip.com/gb/
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 8

Expert Comment

by:Autogard
ID: 17095421
Wow, that's pretty involved.  Cool idea, though.

Yeah, you can get IP and host name using the method you explained above (I would also recommend using gethostbyaddr -- www.php.net/gethostbyaddr).  For some of the more advanced things, the browscap that I showed you should work.  There are other things like showing the country, etc... that would take extra work to do.

This should get you started at least though.
0
 

Author Comment

by:blaadom
ID: 17095733
showing the country and the isp as well as the users broadband exchange invloves getting an account with MaxMind, or similar, something on here http://www.maxmind.com/app/products . They have API's and the like but of course it costs money as you are using their database for some data mining. I might look into doing that if the website becomes proifitable.

It would be a nice touch as you mentioned. Thanks for the advise.
0
 
LVL 8

Expert Comment

by:Autogard
ID: 17095883
Yeah, because of so many variables (e.g. proxies, etc...) it is a really hard thing to be exact on the country and other similar information.  If you were to eventually go with a company like the one you mentioned I would make sure that they can guarantee some kind of accuracy or at least you can find out how they handle proxies, etc...

There are other free alternatives that may or may not be as good, I remember there being some EE questions on this topic.
0
 

Author Comment

by:blaadom
ID: 17096270
yes http://www.hostip.info/index.html is one site which offers a database of known IP addresses for free. http://ip-to-country.webhosting.info/ offer the same service.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now