Forum Moderators: coopster

Message Too Old, No Replies

how to get the online user's MAC address using PHP

         

hsceeus

5:58 am on Aug 4, 2006 (gmt 0)

10+ Year Member



When user browse the web site, what method can be used to get the user's MAC address? hope help form somebody... thanks

lobo235

4:22 pm on Aug 4, 2006 (gmt 0)

10+ Year Member



It's not possible. The best you can do is something the following in linux:

ping 127.0.0.1 && arp -a

replace 127.0.0.1 with the address of the user (obviously). This only works on a LAN or if the user is connected directly to your webserver without going through any routers or NAT. If they go through a router or NAT then the MAC address will be the MAC address of the last router the packets came through (this could also be your own router if your server sits behind one). I would only trust this on a LAN. You will have to parse the output of the above command in order to pull the MAC address out of it.

hanglide

8:57 pm on Aug 4, 2006 (gmt 0)

10+ Year Member



Just curious. Why would you need to know the MAC? The only reason I can think of is to ban a user for some reason but that would seem to be over the top.. especially considering that they can change the MAC on most NIC's pretty easily.

mcavic

11:42 pm on Aug 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It would be a good way to uniquely identify a specific computer. But no, the Web server won't know the user's MAC address when there's a router between them.

You'd have to run a piece of code on the user's machine to get the address and send it back to the server. Maybe ActiveX or Java.

hsceeus

3:22 am on Aug 5, 2006 (gmt 0)

10+ Year Member



can i use PHP to run a piece of code on the user's machine to get the address and then send it back to the server?

coopster

3:36 am on Aug 5, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



No, PHP runs on the server-side, not the client-side.

Jaunty Edward

7:38 am on Aug 7, 2006 (gmt 0)

10+ Year Member



Hi,

I think its possible... I don't know how....

My internet provider has somehow restricted the internet access only to my PC... without installing any software....

When I bot the laptop i called him and told him that I am getting Access denied error from laptop... he asked to hold the line and in 2mins it started allowing me to login to the webpanel and get connected to the net.

Although it may be true that its only possible on a LAN.

The webpanel given the net provider has a .php extension.

Thanks
BYe

coopster

11:48 am on Aug 7, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Internet Service Providers (ISP) can allow access from a single MAC address if they choose to do so. That is why you see routers being sold that allow you to set a MAC address in them. If you were routing all your traffic through a single point (gateway) such as this, you likely would have never had the issue.