Home  >  Article  >  Backend Development  >  Obtain the unique identification of the computer [CPU, network card MAC address] through exec under PHP_PHP tutorial

Obtain the unique identification of the computer [CPU, network card MAC address] through exec under PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:28:29818browse

Copy code The code is as follows:

//Get the computer’s CPU information

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 MAC address of the network card

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323581.htmlTechArticleCopy the code as follows: //Get the computer’s CPU information function OnlyU(){ $a = ''; $ b = array(); if(function_exists('exec')){ if(mailto:!@exec( /all",$b)){ return false; } }elseif(fu...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn