Getting the end-users MAC Address

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
mikeashfield
Forum Contributor
Posts: 159
Joined: Sat Oct 22, 2011 10:50 am

Getting the end-users MAC Address

Post 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.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: Getting the end-users MAC Address

Post 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.
mikeashfield
Forum Contributor
Posts: 159
Joined: Sat Oct 22, 2011 10:50 am

Re: Getting the end-users MAC Address

Post 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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Getting the end-users MAC Address

Post by Benjamin »

The MAC address can be spoofed.
mikeashfield
Forum Contributor
Posts: 159
Joined: Sat Oct 22, 2011 10:50 am

Re: Getting the end-users MAC Address

Post 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.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Getting the end-users MAC Address

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Getting the end-users MAC Address

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Getting the end-users MAC Address

Post by VladSun »

Closely related discussions here:

viewtopic.php?f=6&t=89514
viewtopic.php?f=19&t=104832
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply