国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

用ASP做的DNS LOOKUP程序

2019-11-18 21:11:23
字體:
來源:轉載
供稿:網友
文章轉譯自asp101

運行環境,NT(SERVER、WORKSTATION)、W2K

服務器上需要安裝WSH2.0或者更高版本

如果您的系統目前沒有安裝WSH2.0,您可以從以下這個地址去下載它

http://www.microsoft.com/msdownload/vbscript/scripting.asp

里面包含了WSH2.0

下面是源代碼

<%@ Language="VBScript" %>
<% Option Explicit %>
<%
If Request.Form("frmHost") = "" Then
    '設置初始值
    strIP = Request.ServerVariables("REMOTE_ADDR")
Else
    strIP = Request.Form("frmHost")
End If
%>
<html>
<head>
    <title>DNS Lookup [v 1.0]</title>
</head>
<body bgcolor="#FFFFFF">

<form Method="POST" Name="frmRDNS">
    <label for="frmHost"><u>Host:</u></label>
    <input type="text" name="frmHost" ID="frmHost"
        value="<%= strIP  %>">
    <input type="button" name="btnSubmit" ID="btnSubmit"
        value="Lookup" onClick="document.frmRDNS.submit()">
</form>

<font face="arial" size="2" color="#003366">
<%
rMethod = uCase(Request.ServerVariables("REQUEST_METHOD"))
If rMethod = "POST" Then
    ' Lookup Host
    strReturn = nsLookup(strIP)
    If strReturn <> "" Then
        Response.Write strReturn
    Else
        ' A Lame Host is any Valid Host that DNS Cannot Resolve
        ' See InterNic for Details
        Response.Write "<b>Lame Host - Could Not Resolve DNS For " _
            & strIP & "</b><br>"
    End If
End If

Function NSlookup(strHost)
    'Create Shell Object
    Set oShell = Server.CreateObject("Wscript.Shell")
    'Run NSLookup via Command     oShell.Run "%ComSpec% /c nslookup " & strHost _
        & "> C:/" & strHost & ".txt", 0, True

    'Open the temp Text File and Read out the Data
    Set oFS = Server.CreateObject("Scripting.FileSystemObject")
    Set oTF = oFS.OpenTextFile("C:/" & strHost & ".txt")

    tempData = Null
    Data = Null
    i = 0
    Do While Not oTF.AtEndOfStream
        Data = Trim(oTF.Readline)
            If i > 2 Then ' Don't want to display local DNS Info.
                tempData = tempData & Data & "<BR>"
            End If
        i = (i + 1)
    Loop

    'Close it
    oTF.Close
    'Delete It
    oFS.DeleteFile "C:/" & strHost & ".txt"

    Set oFS = Nothing
    nsLookup = tempData
End Function
%>
</font>

</body>
</html>

代碼很簡單,我不多說了,如果您對WSH有什么疑問的話,請去下載WSH的電子文檔中文版本的,CHINAASP下載區就有的吧

希望能對你有所幫助。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 名山县| 淅川县| 南安市| 北京市| 临朐县| 东至县| 中卫市| 泾川县| 菏泽市| 隆尧县| 泰安市| 霸州市| 南澳县| 武强县| 扎兰屯市| 楚雄市| 化隆| 辽宁省| 德庆县| 桃江县| 白河县| 奉节县| 五指山市| 聂拉木县| 阿荣旗| 秦安县| 涡阳县| 娄烦县| 安福县| 托克逊县| 抚顺县| 太仆寺旗| 绍兴县| 柳州市| 湛江市| 驻马店市| 东阳市| 巴青县| 平昌县| 五寨县| 盈江县|