• 12-12-2006, 21:52:34
    #1
    Zaman zaman gerek oluyor php ile mac adresini bulma kodu lazım olabilir belki

    <?
    class NtMacAddress {
    
        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\' ?';
            }
        }
    
    
        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';
        }
    
    
        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';
        }
    }
    
            $mac = &new NtMacAddress();
           echo 'SERVER MAC: '.$mac->getMac( 'server' ).'<br />CLIENT MAC: '.$mac->getMac( 'client' );
    ?>
  • 17-12-2006, 12:55:58
    #2
    saolasın deneyelim bakalım
  • 17-12-2006, 13:07:44
    #3
    Üyeliği durduruldu
    iddaa kodu mu?
  • 17-12-2006, 13:21:25
    #4
    Kimlik doğrulama veya yönetimden onay bekliyor.
    SERVER MAC: not found
    CLIENT MAC: not found

    Diyo Bende
  • 17-12-2006, 14:24:41
    #5
    Yalan bunlar ne mac adresi Anca sunucunun mac adresini alırsınız bununla
  • 17-12-2006, 14:53:47
    #6
    Misafir
    ..........................
  • 20-12-2006, 12:31:03
    #7
    Üyeliği durduruldu
    Alıntı
    CLIENT MAC: '.$mac->getMac( 'client' );
    bu damı server ?
  • 20-12-2006, 12:48:35
    #8
    exec( 'nbtstat -A '.$_SERVER['REMOTE_ADDR'], $output );

    exec system passthru gibi zimbirtilarin açılması gerekiyor o da güvenlik tehlikesi oluşturur
  • 21-12-2006, 09:36:19
    #9
    Üyeliği durduruldu
    önce adamın gerçek ip sini bulmak gerekmez mi