systech44 Posted December 15, 2010 Share Posted December 15, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221752-mac-address/ Share on other sites More sharing options...
MMDE Posted December 15, 2010 Share Posted December 15, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221752-mac-address/#findComment-1147632 Share on other sites More sharing options...
systech44 Posted December 21, 2010 Author Share Posted December 21, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/221752-mac-address/#findComment-1149811 Share on other sites More sharing options...
trq Posted December 21, 2010 Share Posted December 21, 2010 Is there a way to get client's MAC address who is accessing the website? No. All you can access via php (which runs on the server) is whatever the client sends you. Quote Link to comment https://forums.phpfreaks.com/topic/221752-mac-address/#findComment-1149813 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.