@exec("ipconfig /all",$array);
for($Tmpa;$Tmpa<(count($array))/2;$Tmpa++){
if(eregi("Physical",$array[$Tmpa])){
$mac=explode(":",$array[$Tmpa]);
echo $mac[1];
}
if(eregi("IP Address.",$array[$Tmpa])){
$ip=explode(":",$array[$Tmpa]);
echo $ip[1];
}
}
$user_IP = ($_SERVER["HTTP_VIA"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"];
$user_IP = ($user_IP) ? $user_IP : $_SERVER["REMOTE_ADDR"];
echo $user_IP;
?>
function GetMacAddr()
{
$return_array = array();
$temp_array = array();
$mac_addr = "";
@exec("arp -a",$return_array);
foreach($return_array as $value)
{
if(strpos($value,$_SERVER["REMOTE_ADDR"]) !== false &&
preg_match("/(:?[0-9a-f]{2}[:-]){5}[0-9a-f]{2}/i",$value,$temp_array))
{
$mac_addr = $temp_array[0];
break;
}
}
return ($mac_addr);
}
echo GetMacAddr();
?>
阅读(2050) | 评论(0) | 转发(0) |