How to detect the MAC address of the user viewing our website using PHP?
I know how to track down an IP address, but I need to track down the MAC address of the users viewing my page.
How开发者_JAVA技巧 to accomplish this?
Unless the user is on the same LAN as the webserver, you cannot do this. MAC addresses are on the ethernet layer below TCP/IP, and are not included in TCP/IP packets routed off the users local network.
In some environments, it might be possible use to a client-side plugin to allow Javascript access to the MAC address, and transmit that information to the server.
If this is some kind of LAN based web application, you could try getting the MAC address out of the ARP cache. How you do this will depend on the operating system, but under Linux you could parse the output of arp -n
You can't. ... Well not without the aid of some fully trusted client software (aka a browser plug-in) to help.
The MAC address is not supplied by the browser as part of it's request and is not accessible via client side javascript either.
The only way to gather such information is to supply a browser plug-in that can retrieve such details on your behalf. In the case of most browser / operating system combinations, this will require your users trusting and installing the plug-in.
This effectively means that it's possible to engineer such a solution for an enterprise environment... but extremely unlikely to work for a public facing website.
If you're looking to achieve authentication (for the purposes of either access or auditing) then I would suggest investigating other options such as certificates and the like.
You can't. In general, you can't know the MAC address of your users.
However, for IE on trusted websites, see this.
精彩评论