I am using this code to get the MAC address. I can see the MAC address tracked in my DB, when it is running in Local. But if i host the code in the server, it is not tracking. kindly give a solution for this?
function getmac_addr()
{
system('ipconfig /all'); //Execute external program to display output
$mycom=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean (erase) the output buffer
$ipAddress=$_SERVER['REMOTE_ADDR'];
$findme = "Physical";
$pmac = strpos($mycom, $findme); // Find the position of Physical text
$mac=substr($mycom,($pmac+36),17); // Get Physical Address*/
return $mac;
}
As the php code will be running on the server, it will be calling the ipconfig program on that machine. Is it possible it’s running a different OS, that maybe doesn’t have an ipconfig command, or maybe security configuration prevents web code from running it? Maybe if you’re on Windows but the server is running Linux, that might explain it. And aren’t you just getting the MAC address of the server, which won’t change all that often?
Who runs the server, is it your own or a hosted one? If the latter, have you asked them whether there’s a security block on running ipconfig? But, if it’s on the server, won’t the MAC always be the same anyway?
The only way to track a MAC address outside of a private network is to use a radius server.
AND
You will have to configure the access point that the user is connected to into a radius client.
When I get on the internet, the only person that can see my MAC is my ISP or a captive portal (radius client) that uses a radius server.