廢話不多講
<?php
class MacAddr
{
public $returnArray = array();
public $macAddr;
function __contruct($os_type=null){
if(is_null($os_type)) $os_type = PHP_OS;
switch (strtolower($os_type)){
case "linux":
$this
break;
case "solaris":
break;
case "unix":
break;
case "aix":
break;
default:
$this
break;
}
$temp_array = array();
foreach($this
if(preg_match("/[
$this
break;
}
}
unset($temp_array);
return $this
}
function forWindows(){
@exec("ipconfig /all"
if($this
return $this
else{
$ipconfig = $_SERVER["WINDIR"]
if (is_file($ipconfig))
@exec($ipconfig
else
@exec($_SERVER["WINDIR"]
return $this
}
}
function forLinux(){
@exec("ifconfig
return $this
}
}
$mac = new MacAddr(PHP_OS);
echo $mac
echo "<br />";
// 獲取客戶端
// linux
$command = "arp
echo $command;
echo "<br />";
$result=`{$command}`;
// windows
$command = "nbtstat
echo $command;
echo "<br />";
$result=`{$command}`;
print_r($result);
?>
獲取服務端的邏輯沒什麼大問題
獲取客戶端的時候
<script language="JScript" event="OnCompleted(hResult
document
</script>
<script language="JScript" event="OnObjectReady(objObject
if(objObject
</script>
<object id="locator" classid="CLSID:
<object id="foo" classid="CLSID:
<script language="JScript">
var service = locator
var MACAddr ;
var IPAddr ;
var DomainAddr;
var sDNSName;
service
service
</script>
<form><input type="text" id=
只適用於IE浏覽器
From:http://tw.wingwit.com/Article/program/PHP/201311/20952.html