头像

PHP获得计算机的唯一标识

2018-04-17 09:45:12 来源:PHP代码   浏览()   评论 ( 0 )   

//获取电脑的CPU信息
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
//获取网卡的MAC的地址
function getMAC() {
 @exec("ipconfig /all",$array);
 for($Tmpa;$Tmpa<count($array);$Tmpa++){
  if(eregi("Physical",$array[$Tmpa])){
   $mac=explode(":",$array[$Tmpa]);
   return $mac[1];
  }
 }
}


标签: php
声明:转载请注明来源(PHP代码)并保留原文链接:https://www.phpdaima.com//wenzhang-92.html
广告不存在
评论0

后面还有条评论,点击查看>>

温馨提示:为规范评论内容,垃圾评论一律封号...