Page 1 of 1

Getting the end-users MAC Address

Posted: Sun Oct 23, 2011 6:10 pm
by mikeashfield
Hello,

I'm looking for a viable way of coding some PHP that inserts the users MAC address into my MySQL table when a request is sent (form submission). I know that PHP is server-side scripting and all, but it must be possible; surely?

Why I need to do this is because, so far I've been logging the IP when a request is sent so that I can track the usage of individuals (I don't need their identity) just to track if it's the same device making requests. But the project is targeted at mobile devices, so the IP addresses are changing quite frequently so I'm finding that I can't accurately track usage. If anybody can suggest a better way of overcoming this, without using the device's MAC address then please feel free to leave comments! :)

http://arrivaduties.dyndns-work.com:1991/mobile.php


Thanks in advance,
Mike.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 1:21 am
by Mordred
You can't get the MAC address without client-side code (read: browser plugin)
There are other ways to identify users: cookies for example.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 4:04 am
by mikeashfield
Could this perhaps be processed by some sort of Javascript and then passed as a variable? I wanted to steer away from using Cookies really as they can be cleared, then I'll again get duplicated values. Actually thinking on .. I might look into having some Javascript get the MAC address, store it as a cookie, and then have the PHP read the cookie. That way it'll never change.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 4:22 am
by Benjamin
The MAC address can be spoofed.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 5:32 am
by mikeashfield
Benjamin wrote:The MAC address can be spoofed.
I totally understand this, but the end product is only being used by mobile devices (iPhones in particular); so unless the device is JailBroken, they're not going to be able to change the devices MAC address.

Cheers.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 7:51 am
by Eric!
mikeashfield wrote:Could this perhaps be processed by some sort of Javascript and then passed as a variable?
Probably easier to spoof than the IP using a browser plug-in...assuming your goal is added security. If you're just trying to get a MAC then you could try javascript. I'm not 100% sure the MAC is available at that layer, but I've never looked into it. General Javascript is not that trusted. I'm guessing you'd have to use signed javascript (disabled by default in FF) or some activeX thing in IE.

Re: Getting the end-users MAC Address

Posted: Tue Oct 25, 2011 10:15 am
by pickle
The MAC address isn't accessible by Javascript. On the iPhone you're going to have pretty much zero opportunity to access the MAC address via a website. You should stop trying to build a system that requires the user not do something, and instead build it so it's flexible enough to recover when they inevitably do.

Re: Getting the end-users MAC Address

Posted: Wed Oct 26, 2011 3:54 pm
by VladSun
Closely related discussions here:

viewtopic.php?f=6&t=89514
viewtopic.php?f=19&t=104832