PHP obtains the unique identifier of a computer [CPU, Nic MAC address]

Source: Internet
Author: User
PHP obtains the computer's unique identifier [CPU, Nic MAC address] to obtain the computer's CPU information functionOnlyU () {$ a; $ barray (); if (function_exists (exec )) {if (mailto :! @ Exec (all, $ B) {returnfalse ;}} elseif (fu PHP obtains the unique identifier of the computer [CPU, Nic MAC address]

// 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 ($ )? False: $ a;} // End function OnlyU // Obtain the Nic MAC address function getMAC () {@ exec ("ipconfig/all", $ array ); for ($ Tmpa; $ Tmpa <count ($ array); $ Tmpa ++) {if (eregi ("Physical", $ array [$ Tmpa]) {$ mac = explode (":", $ array [$ Tmpa]); return $ mac [1] ;}}

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.