开发者

HTML\PHP - How to elicit user (visitor)'s info

How to elicit user's information when he/she is visiting your website?

  • IP Address
  • Mac Address
  • User Profile Name
  • OS Name
  • 开发者_如何转开发
  • OS version
  • OS Registered to (Name/Company)
  • Computer Name
  • Browser Name
  • Browser Version
  • ISP Name/Internet Connection Provider Name
  • Connection Type
  • Location - City/Country (based on IP)


The answer to most of what you're asking is either 'impossible', 'impossible with javascript, use ajax to get it from the server-side', or 'parse the user string' (which can always be spoofed).

  • IP Address: You have to use a serverside language. If you need it dynamically, you can get it from an AJAX call. In PHP, it's $_SERVER['REMOTE_ADDR']
  • Mac Address: Not available, except very very rarely if the user is using IE and has poor security settings.
  • OS, OS Version: You can get it by parsing the User Agent String. A script like this can do it pretty robustly: http://www.quirksmode.org/js/detect.html
  • OS registered to: Impossible.
  • Computer Name: Impossible.
  • Browser Name, Browser Version: You can get it by parsing the User Agent String. A script like this can do it pretty robustly: http://www.quirksmode.org/js/detect.html
  • ISP: You'll need to use some kind of 3rd party database for querying who owns an IP. Or, you can call a command line 'whois'. In PHP, that would look like shell_exec("whois $_SERVER['REMOTE_ADDR']"); that would return the whois record for that IP address, which you can parse to get an ISP.
  • Location: You'll need to use some kind of 3rd party tool to associate an IP address with a general region. (something like this: http://ipinfodb.com/ip_location_api.php)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜