• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1185
  • Last Modified:

Browser and OS detection

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
blaadom
Asked:
blaadom
  • 4
  • 3
1 Solution
 
AutogardCommented:
>>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
 
AutogardCommented:
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
 
blaadomAuthor Commented:
I'm developing a website which retrives browser settings and the likes.
Something similar to http://www.showmyip.com/gb/
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AutogardCommented:
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
 
blaadomAuthor Commented:
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
 
AutogardCommented:
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
 
blaadomAuthor Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now