How do i get user mac address?
Moderator: General Moderators
-
kennedysee
- Forum Newbie
- Posts: 14
- Joined: Fri Dec 04, 2009 12:17 am
How do i get user mac address?
How do i detect the user mac address when they visit the website?
Somehow i manage to detect the pc that is running apache, but not from another computer. It keep prompting the same mac address....
Somehow i manage to detect the pc that is running apache, but not from another computer. It keep prompting the same mac address....
Re: How do i get user mac address?
The MAC address isn't passed on any layer PHP can access.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: How do i get user mac address?
If the user is a host on the same local network you could use the arp cache to find the mac using the IP address you can get in PHP.
Although if there is a layer3 device such as a router between you and the client this wouldn't work, instead you would be returned the MAC of the routing device.
Although if there is a layer3 device such as a router between you and the client this wouldn't work, instead you would be returned the MAC of the routing device.
-
kennedysee
- Forum Newbie
- Posts: 14
- Joined: Fri Dec 04, 2009 12:17 am
Re: How do i get user mac address?
Then in what other language can i retrieve for MAC address?pickle wrote:The MAC address isn't passed on any layer PHP can access.
<?php
function getMac(){
exec("ipconfig /all", $output);
foreach($output as $line){
if (preg_match("/(.*)Physical Address(.*)/", $line)){
$mac = $line;
$mac = str_replace("Physical Address. . . . . . . . . :","",$mac);
}
}
return $mac;
}
$mac = getMac();
$mac = trim($mac);
?>
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: How do i get user mac address?
good function i read it knowledgeable article.
Re: How do i get user mac address?
Note that the getMac() function above gets the mac address of the server, not the visitorkennedysee wrote:Then in what other language can i retrieve for MAC address?
-
kennedysee
- Forum Newbie
- Posts: 14
- Joined: Fri Dec 04, 2009 12:17 am
Re: How do i get user mac address?
Apollo wrote:Note that the getMac() function above gets the mac address of the server, not the visitorkennedysee wrote:Then in what other language can i retrieve for MAC address?(and only if the host is a windows machine)
how do i get the visitor mac address?
Re: How do i get user mac address?
You can't.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
kennedysee
- Forum Newbie
- Posts: 14
- Joined: Fri Dec 04, 2009 12:17 am
Re: How do i get user mac address?
Any other way?pickle wrote:You can't.