Get the computer's unique identity under PHP via exec [CPU, Nic MAC address]_php tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
Get CPU information from your computer

function Onlyu () {
$a = ";
$b = Array ();
if (function_exists (' exec ')) {
if (mailto:! @exec (/all ", $b)) {
return false;
}
}elseif (function_exists (' system ')) {
Ob_start ();
if (mailto:! @system (/all ")) {
return false;
}else{
}
$b = Ob_get_contents ();
Ob_end_clean ();
$b = explode ("\ n", $b);//print_r ($b);
Array_pop ($b);
}else{
return false;
}

$all = sizeof ($b);
for ($i = 0; $i < $all; $i + +) {
if (Strpos ($b [$i], "Description")!== false) {
if (Strpos ($b [$i +1], "physical Address")!== false) {
$c = Explode (":", $b [$i +1]);
$a = Trim ($c [1]);
Break
}
}
}//End for
return empty ($a) false: $a;
}//End function Onlyu


Get the address of the MAC for the NIC

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

http://www.bkjia.com/PHPjc/323581.html www.bkjia.com true http://www.bkjia.com/PHPjc/323581.html techarticle Copy the code as follows://Get CPU information of the computer function Onlyu () {$a = ' '; $b = array (); if (function_exists (' exec ')) {if (mailto:! @exec (/all "), $b)) {return false;}} ElseIf (Fu ...

  • 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.