国产探花免费观看_亚洲丰满少妇自慰呻吟_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下載區就有的吧

希望能對你有所幫助。


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

圖片精選

主站蜘蛛池模板: 铜山县| 盐津县| 大兴区| 贵溪市| 遂溪县| 宝清县| 大埔县| 颍上县| 滨州市| 六安市| 诸暨市| 滨海县| 保定市| 曲麻莱县| 延边| 东源县| 凤台县| 紫金县| 南召县| 东兰县| 卢龙县| 池州市| 云霄县| 任丘市| 扶沟县| 郧西县| 泗水县| 赣州市| 绍兴市| 吉安县| 遂川县| 太仓市| 成安县| 澄城县| 开远市| 五华县| 盐池县| 包头市| 武隆县| 繁昌县| 高州市|