• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • asp 讀取網卡mac地址

    發表于:2007-06-30來源:作者:點擊數: 標簽:
    % Dim RemoteAddr if Request.ServerVariables(HTTP_X_FORWARDED_FOR)=Empty then remoteaddr=Request.ServerVariables(REMOTE_ADDR) else RemoteAddr=Request.ServerVariables(HTTP_X_FORWARDED_FOR) end if If GetMac(RemoteAddr) then session(mac) = GetM
    <%
    Dim RemoteAddr
    if Request.ServerVariables("HTTP_X_FORWARDED_FOR")=Empty then
    remoteaddr=Request.ServerVariables("REMOTE_ADDR")
    else
    RemoteAddr=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    end if
    If GetMac(RemoteAddr)<> "" then
    session("mac") = GetMac(RemoteAddr)
    End If
    sql="select * From MacAddress where mac_address=‘’"&GetMac(RemoteAddr)&"‘’"
    set rst = server.CreateObject("ADODB.Recordset")
    rst.open sql,conn,1,3
    set rst=nothing
    Response.Write(GetMac(RemoteAddr))

    ‘’由于讀取某IP的網卡MAC地址


    ‘’本程序調用arp命令通過查詢本機arp表讀取特定IP的MAC地址


    ‘’本程序需要“WSCRIPT.SHELL”和“Scripting.FileSystemObject”兩個組件,

    ‘’請確保您的服務器可以正常使用這兩個組件

    ‘’本程序需要調用Cmd.exe程序,臨時文件保存結果,請確保IIS來賓帳號對程序有訪問權限,

    ‘’臨時目錄有寫‘’權‘’限。
    function GetMac(IP)
    On Error Resume Next
    Dim oScript
    Dim oFileSys, oFile
    Dim All, szTempFile,ipc,phyc,typec
    Dim TempPath
    Set oScript = Server.CreateObject("WSCRIPT.SHELL")
    Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
    TempPath="d:\temp\" ‘’臨時目錄
    szTempFile = TempPath & oFileSys.GetTempName() ‘’ 獲取臨時文件名
    Call oScript.Run ("cmd.exe /c ping -n 2 " & IP, 0, True) ‘’Arp表中須有此IP
    Call oScript.Run ("cmd.exe /c arp -a " & IP & " > " & szTempFile, 0, True)
    Set oFile = oFileSys.OpenTextFile (szTempFile, 1, False, 0)
    All=oFile.ReadAll()
    oFile.Close
    If (IsObject(oFile)) Then
    Call oFileSys.DeleteFile(szTempFile, True)
    End If
    arr = Split(All, vbCrLf)
    If UBound(arr) = 4 Then
    Ipc= InStr(1, arr(2), "Inte.net Address")
    phyc = InStr(1, arr(2), "Physical Address")
    typec = InStr(1, arr(2), "Type")
    If typec > phyc And phyc > IpcAnd ipc > 0 Then
    GetMac=Ucase(Trim(CStr(Mid(arr(3), phyc, typec - phyc))))
    End If
    End If
    End function
    %>

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>