Hello ! Hopr you're fine ; I wanna to know if , I can get client mac address and some other information using PHP Script? Thank's
Only in IE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script id="clientEventHandlersJS" type="text/javascript"> <!-- function btnGo_onClick() { // Connect to WMI var locator = new ActiveXObject("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); // Get the info var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); // Output info document.write("<table border=1>"); document.write("<thead>"); document.write("<td>Caption</td>"); document.write("<td>MAC Address</td>"); document.write("</thead>"); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("<tr>"); document.write("<td>" + p.Caption + "</td>"); document.write("<td>" + p.MACAddress + "</td>"); document.write("</tr>"); } document.write("</table>"); } //--> </script> </head> <body> <h1>MAC Address</h1> <INPUT id="btnGo" name="btnGo" type="button" value="Go" onclick="javascript:btnGo_onClick()"> </body> </html> Code (markup):
Hello Friends ! Thank you C.Whyte & commandos for help ! I know that PHP run in server-side , and using IE Activex is not a good solution because it's not compatible with all web browser , an example activex & Vbscript are not accepted in Mozilla Firefox , I've seen some php script that can extract Mac Address of client connected to you server , from network , using : system ("Unix Command") !!! mybe unix shell command like "ipconfig" can extract MAC address! thank's
ipconfig/ ifconfig would only get the server's ip address. MAC addresses are not passed across the whole internet from client to server.
Hello ! Asker will help now this command line get MAC Address : $mac = `ping $ip && arp -a | grep $ip` PHP: $ip is the remote IP address , when you call this PHP function you will get the MAC Address : function returnMacAddress() { // Get the arp executable path $location = `which arp`; // Execute the arp command and store the output in $arpTable $arpTable = `$location`; // Split the output so every line is an entry of the $arpSplitted array $arpSplitted = split("\n",$arpTable); // Get the remote ip address (the ip address of the client, the browser) $remoteIp = $GLOBALS['REMOTE_ADDR']; // Cicle the array to find the match with the remote ip address foreach ($arpSplitted as $value) { // Split every arp line, this is done in case the format of the arp // command output is a bit different than expected $valueSplitted = split(" ",$value); foreach ($valueSplitted as $spLine) { if (preg_match("/$remoteIp/",$spLine)) { $ipFound = true; } // The ip address has been found, now rescan all the string // to get the mac address if ($ipFound) { // Rescan all the string, in case the mac address, in the string // returned by arp, comes before the ip address reset($valueSplitted); foreach ($valueSplitted as $spLine) { if (preg_match("/[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f][:-]". "[0-9a-f][0-9a-f]/i",$spLine)) { return $spLine; } } } $ipFound = false; } } return false; } PHP: Thank you for good idea !
Hello! Thank's for help here I try to find a solution that detect client MAC addresse using PHP or Perl Scrpit , reason of security more inside I want to do a secure connection between to PC via internet .... Thank's for great ideas Best Regards
I don't know why you think the MAC address is a secure way of forming a connection... MACs are EASILY cloned. There's tons of standard ways to make a secure connection between PCs on the internet. They're standard for a reason and will be quicker and more secure than your own code. You're probably after some form of VPN or SSH connection.
If you really need security, you should use a solid user management system, or a public-private key pair for authentication. There is no such thing as a secure connection to an anonymous user in any situation.
Egoldseller , means , whats the solution to secure your ressources , example : I've a website for pey per click for unique IP , some user will click many time by changing IP, and there is many peoples they have a dynamic IP Address !!! I think to detect visitor by his MAC address !!!! or ther is an other solution to share?
I know , thery many way to change MAC , ex : in windows registry by changing Network Address Key .... and ther's many software do that , but not many peoples know this way !!! Please if you have another idea share it here?
Would be great if other browsers also supports receive and store MAC addresses. Although its not 100%, its just an extra security feature for now, against clickfraud and also ban people.
The fact the IE does store it is more of a security concern than a solution to user identification. I wouldn't count on that one being around for a long time.