PHP gets the unique identification of the computer [CPU, Nic MAC address]

Source: Internet
Author: User
Tags array explode

 //Get CPU information for your computer

  function Onlyu () {         $a = ';          $b = array ()  & nbsp      if (function_exists (' exec ')) {                if (mailto: ! @exec (/all ", $b)) {                        return false;                &NBSP,         }elseif function_exists (' System ') {                ob_start ();          &NBS P      if (mailto:! @system (/all)) {                   &NBS P    return false;                 }else{               &NBSP}                  $b = ob_get_contents ();    &NBsp            ob_end_clean ();                  $b = explode ("\ n", $b);//print_r ($b);                 array_pop ($b);         }else{                return false  & nbsp                  $all = sizeof ($b);         for ($i = 0 $i < $all; $i + +) {               & Nbsp;if (Strpos ($b [$i], "Description")!== false) {                   &NBS P    if (Strpos ($b [$i +1], "Physical Address")!== false) {               &NB Sp                 $c = Explode (":", $b [$i +1]);                            &NBsp     $a = Trim ($c [1]);                                 break ;                        &NBSP,        &NBS P       &NBSP}         //end for         return empty ($ A)? false: $a; //End Function Onlyu      //Get the MAC address   function Getmac () {  @exec ("Ipconfig/all", $array) of the NIC;  for ($Tmpa; $Tmpa <count ($array); $Tmpa + +) {  if (eregi ("Physical", $array [$Tmpa])) {   $ Mac=explode (":", $array [$Tmpa]);    return $mac [1];   } &nbsp}}




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.