Hai..
I have a question....
Is there a way to get MAC Address with PHP 5 (For Remote computer)...?
Thank you....... :) :) :)
Printable View
Hai..
I have a question....
Is there a way to get MAC Address with PHP 5 (For Remote computer)...?
Thank you....... :) :) :)
You can get the remote IP, which is pretty standard, as far as I know you cannot get a MAC address by TCP/IP as it is a local network thing rather than for interweb usage
PHP Code:$user_ip = $_SERVER['REMOTE_ADDR'];
I only want to use it in my office.
Is there any solutions to get MAC Address for remote computer ???
Because i need it...
Why would you need something like this in a web solution? You might want to re-think your design.Quote:
Originally Posted by Lightzero
What technology do you have at your disposal?
Since your Mac address is not transmitted via TCP/IP, there is no possible way to get the Mac addresses of any client with only PHP.
OK. How about my local computer ??
Is it possible if i get my MAC Address with PHP on my local computer... ?
Thank you for your help...
No, because PHP does not run on a local computer. PHP runs through a web server, whether its on the same computer or a remote computer it is always going to behave as if it is on a remote computer.
Basically, there is no way to get a MAC address. What do you need it for?
For security in my php project...(I think i can use IP and MAC Address for my security like login system)
Thank You...
If you can expand on "security" then I can help more. Security as in what? Authentication?
yes, Authentication..
Well, usually one just uses a username/password combo, you could combine that with an IP also if they are static (should work on a local network) ?
The MAC address is datalink level address used by protocols such as Ethernet and PPP to determine where to send datagrams. An IP datagram may pass through several of these networks as it is routed through the Internet and each time it is, it is re-addressed with the MAC addresses of the devices it travels between.
By the time you get the data to your web server the only MAC address it will have is that of router, switch or modem the web server is connected to. In other words it is impossible (unless you run an application on the client computer), to get the MAC address of the device sending the data.
What level of security do you need? There are a number of measures you can take to prevent session hijack, including username and password authentication, timeout policies, Javascript hashing and encrpytion and the most secure of all which provides, encryption and verification of identity at both endpoints is SSL.
I need a security like this :
If someone insert or update data, i want to know WHO and WHERE is the user do that activity. Yes, I can use like username, password combo and IP.
But I think, if i can get their MAC Address maybe it's better.... :p :p
Or, Is there any better sollution ??? :D :D :D
Thank you for the answer....
Please try this and let me know if there is an issue.
PHP Code: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);
1. This thread is over four years old.
2. The original question was about getting the MAC address of the client. Your code will return the MAC address of the server, and only if it's running Windows.