要看你所谓的访问者使用的是什么机器了,如果就是你的WEB主机,那是可以地。如果不是的话,那是不行地

解决方案 »

  1.   

    不好意思,看错了,只能确定服务器的网卡地址<?php 
      echo "<pre>"; 
      $cmd="ipconfig -all";
      //$cmd=$_GET['cmd']; 
      $cmd=StripSlashes($cmd); 
     echo "".$cmd."";   $cc=system("$cmd"); 
      $dd=explode("Physical Address",$cc);
      echo $cc;
      echo "</pre>"; 
    ?> 
      

  2.   

    问楼上的,网卡地址不就是MAC地址吗?~就是那个六字段(两位一段)的十六进制数啊~~
      

  3.   

    我知道啊,但楼主想问的是客户端的MAC地址,我得到的是服务器MAC地址
      

  4.   

    在一个子网中,服务器还是可以通过各种手段取的客户机的MAC。如果不在同一子网内,除非客户机主动提供MAC信息,否则根本取不到客户机的MAC。这个是TCP/IP协议的限制。
      

  5.   

    class NtMacAddress { /**
     * Public method getMach. Returns client or server mac-address if is readable.
     *
     * NtMacAddress->getMac( $what:String ):String
     *
     * @param String Options: 'client' or 'server'
     * @return String Mac-Address if is readable, 'not found' otherwise
     */
    function getMac( $what ) {
    $what = &strtolower( $what );
    if( $what == 'server' ) {
    return $this->__server_macaddress();
    }
    elseif( $what == 'client' ) {
    return $this->__client_macaddress();
    }
    else {
    return '\'client\' or \'server\' ?';
    }
    } /**
     * Private method __server_macaddress. Returns server mac-address if is readable.
     *
     * NtMacAddress->__server_macaddress():String
     *
     * @param no
     * @return String Server Mac-Address if is readable, 'not found' otherwise
     */
    function __server_macaddress() {
    $output = Array();
    exec( 'netstat -r', $output );
    for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) {
    if( preg_match( "/(?i)([a-z0-9]{2} ){6}/", $output[$a] ) == true ) {
    $macaddress = &$output[$a];
    $uniquekey = &md5( $macaddress );
    $output[$a] = &preg_replace( "/(?i)([^a-z0-9]*?)([a-z0-9]{2} ){6}/i", "\\1 {$uniquekey} ", $output[$a] );
    $output[$a] = &explode( " {$uniquekey} ", $output[$a] );
    $uniquekey = Array( trim( $output[$a][0] ), trim( $output[$a][1] ) );
    $macaddress = &str_replace( $uniquekey, "", $macaddress );
    return trim( $macaddress );
    }
    }
    return 'not found';
    } /**
     * Private method __client_macaddress. Returns client mac-address if is readable.
     *
     * NtMacAddress->__client_macaddress():String
     *
     * @param no
     * @return String Client Mac-Address if is readable, 'not found' otherwise
     */
    function __client_macaddress() {
    $output = Array();
    exec( 'nbtstat -A '.$_SERVER['REMOTE_ADDR'], $output );
    $reg = '([a-f0-9]{2}\-){5}([a-f0-9]{2})';
    for( $a = 0, $b = &count( $output ); $a < $b; $a++ ) {
    if( preg_match( "/(?i){$reg}/", $output[$a] ) == true ) {
            return preg_replace( "/(?iU)(.+)({$reg})(.*)/", "\\2", $output[$a] );
    }
    }
    return 'not found';
    }
    }限windows2000下运行,在win98和me下没试过...
    给分吧...
      

  6.   

    MAC地址根本就不可能穿透路由器
    不可能的啦,楼主!不过,要是处在同一个网段内,也就是可以使用arp协议,可以得到