HELP! HELP! detect visitor mac address

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
kennedysee
Forum Newbie
Posts: 14
Joined: Fri Dec 04, 2009 12:17 am

HELP! HELP! detect visitor mac address

Post by kennedysee »

How do i detect the visitor mac address when they visit the website?


<?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);
?>
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: HELP! HELP! detect visitor mac address

Post by manohoo »

I am afraid that what you are asking is impossible... unless the user is in the same private network as your server, in which case you can detect it by using a command line (arp...)

Anyway, may I ask why you need the MAC address? I read that there are techniques to change the MAC address...
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: HELP! HELP! detect visitor mac address

Post by Apollo »

As told before...
kennedysee wrote:
Apollo wrote:
kennedysee wrote:Then in what other language can i retrieve for MAC address?
Note that the getMac() function above gets the mac address of the server, not the visitor :) (and only if the host is a windows machine)
how do i get the visitor mac address?
pickle wrote:You can't.
Really. You can't.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: HELP! HELP! detect visitor mac address

Post by pickle »

Asking the same question won't get you a different answer. Don't double post.

Locked.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Locked