<li class="content" id="pre_1155974693"><?php<br/>/**<br/>マシンのネットワーク カードの物理 (MAC) アドレスを取得します <br/>wwa $Exp <br/>**/<br/>class GetMacAddr<br/>{<br/>var $return_array = array(); // 戻り带有MAC地址の文字列数組<br/>var $mac_addr;<br/><br/>function GetMacAddr($os_type)<br/>{<br/>switch ( strto lower($os_type) )<br/>{<br/>case "linux":<br/>$this->forLinux ();<br/>break;<br/>case "solaris":<br/>break;<br/>case "unix":<br/>break;<br/>case "aix":<br/>break;<br/>default:<br/>$this->forWindows();<br>break;<br> }<br><br>$temp_array = array();<br>foreach ( $this->return_array as $value )<br>{<br>if ( preg_match( "/[0-9a-f][0-9a-f][:-] "."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a- f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f] ]/i", $value, $temp_array ) )<br>{<br>$this->mac_addr = $temp_array[0];<br>break;<br>}<br>}<br>unset($temp_array);<br>return $this->mac_addr ;<br>}<br><br>function forWindows()<br>{<br>@exec("ipconfig /all", $this->return_array);<br>if ( $this->return_array )<br>return $this->return_array;<br>else {<br>$ipconfig = $_SERVER["WINDIR"]."system32ipconfig.exe";<br>if ( is_file($ipconfig) )<br>@exec($ipconfig." /all", $this->return_array);<br>else <br>@exec($_SERVER["WINDIR"]."systemipconfig.exe /all", $this->return_array);<br>return $this->return_array;<br>}<br>}<br><br>function forLinux()<br>{<br> @exec("ifconfig -a", $this->return_array);<br>return $this->return_array;<br>}<br>}<br>?><br><?<br>//$mac = new GetMacAddr(PHP_OS); <br>//echo $mac->mac_addr;<br>?> </li> <p style="width:100%;text-align:center;margin:10px 0"> <br> <br> </p> <p style="width:100%;text-align:center;margin:10px 0"> </p> <p class="clear"></p>