Jump to content

MAC Address


systech44

Recommended Posts

Hello,

 

Please let me know what is the wrong with the following lines of code. I am trying to find the MAC Address of the user who is logging. When I am running the code in localhost it is working. But the same code is not working when I upload it in the server.

 

<?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);
echo $mac;
?>

 

Please help. Thanks a lot in advance.

 

Regards & Thanks.

Link to comment
Share on other sites

I'm not totally sure, but from what I can see is the logic behind your script that php runs on the client side, which is doesn't.

 

If something happens that you don't expect it to, echo everything all the way, to see where it all goes wrong.

Link to comment
Share on other sites

The code displayed is working properly in the localhost. But the code is not working from the server. The server is the linux version. I upload the same script in the server. Now I am trying to see the mac of my PC. I do not found it. My question is, 'Is there a way to get client's MAC address who is accessing the website?'. Please help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.