Solution for obtaining client MAC address for PHP website

Source: Internet
Author: User
Tags php website
Now there is a PHP website, want to get access to the customer's MAC address, which Danale have any good solution, please tell my brother, thank you.


Reply to discussion (solution)

..................

This is impossible.

All you can get is the client's IP address, browser information.

The MAC address is definitely not available unless you make the client-side security control ...

No this scenario

This is really no way.

Unless the execution segment bat or shell script gets

Execute the command with exec and try it.

Let the user input, this is the best way

You have to have a way, remember to post it!

define (' Exec_tmp_dir ', ' C:\WINDOWS\Temp ');

Function Windexec ($cmd, $mode = ') {

$cmdline = "cmd/c $cmd";
if ($mode = = ' FG ') {
$outputfile = Exec_tmp_dir. " \ \ ". Time (). ". txt";
$cmdline. = "> $outputfile";
$m = true;
}
Else $m = false;


$WshShell = new COM ("Wscript.Shell");
$oExec = $WshShell->run ($cmdline, 0, $m);

if ($outputfile) {
$retStr = file_get_contents ($outputfile);
Unlink ($outputfile);
}
Else $retStr = "";

return $retStr;

}

Echo windexec (' Ipconfig/all ', ' FG ');

This window XP can, I have done the test. On top of my machine, I can. I think you can change the window, but the temp file may not be the same location

Define (' Exec_tmp_dir ', ' C:\WINDOWS\Temp ');

function Windexec ($cmd, $mode = ") {

$cmdline = "Cmd/c $cmd";
if ($mode = = ' FG ') {
$outputfile = Exec_tmp_dir. " \ \ ". Time (). ". txt";
$cmdline. = "> $outputfile";
$m = true;
}
else $m = false;


$WshShell = new COM ("Wscript.Shell");
$oExec = $WshShell->run ($cmdline, 0, $m);

if ($outputfile) {
$RETSTR = file_get_contents ($outputfile);
Unlink ($outputfile);
}
else $retStr = "";

return $retStr;

}

echo windexec (' Ipconfig/all ', ' FG ');
On my machine can be, estimate window can be, just to change the location of the temp file.

Define (' Exec_tmp_dir ', ' C:\WINDOWS\Temp ');

function Windexec ($cmd, $mode = ") {

$cmdline = "Cmd/c $cmd";
if ($mode = = ' FG ') {
$outputfile = Exec_tmp_dir. " \ \ ". Time (). ". txt";
......

... ...

Basic concepts
PHP is run on the server side.

Reference to the 9 floor of the reply:

Define (' Exec_tmp_dir ', ' C:\WINDOWS\Temp ');

function Windexec ($cmd, $mode = ") {

$cmdline = "Cmd/c $cmd";
if ($mode = = ' FG ') {
$outputfile = Exec_tmp_dir. " \ \ ". Time (). ". txt";
......
...... This is really only on the server side. The client must have control

One scenario is to implement the server's own module and a PHP module to get the Mac

On time according to principle PHP is generally CGI fastcgi or module

So this has to be done by the server (IIS Apache or Ngnix, etc.)
And then this data has to be passed to PHP
So we have to do a PHP module to receive and handle this


Looks like it's not easy.

This is really hard.

What is the use of getting a MAC without knowing how to do it?
It is important to know that Macs are not cross-web, that is, if you pass through a router

JS calls WMI to get Mac



It can be ~_~.

What is the use of getting a MAC without knowing how to do it?
It is important to know that Macs are not cross-web, that is, if you pass through a router

and MAC address can be changed to change the ...

Do not know what the landlord wants to do? Is it more useful to get a Mac than to get an IP?

Clients get unsolicited uploads, there is no other way.

Agree Upstairs,

It was previously said that using IE controls can

It was previously said that using IE controls can

Now who else is going to install the "Get MAC address to me" control?
It's better to develop a client and integrate the browser functionality.

@exec ("Ipconfig/all", $array);
for ($Tmpa; $Tmpa
if (eregi ("Physical", $array [$Tmpa])) {
$mac =explode (":", $array [$Tmpa]);
echo $mac [1];
}
}

Http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2011/0904/9000.html
I used this to get it.

Http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2011/0904/9000.html
I used this to get it.
This cannot be done only with server-side clients.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.