<% dim strResult if Request.ServerVariables("request_method")="POST" THEN dim strQuery '取得需要查询的域名 strQuery=request("domainname") & "." & request("ext")
dim objSock '创建sock对象 Set objSock=Server.CreateObject("Aspsock.conn") '设置whois服务器为rs.internic.net select case request("ext") case "com","net","org" objSock.RemoteHost="rs.internic.net" gj=0 case "com.cn","net.cn","org.cn" objSock.RemoteHost="drop.cnnic.net.cn" gj=1 end select '设置whois服务器端口为43 objSock.Port=43 '设置操作的超时为60秒 objSock.TimeOut=60 '打开与remotehost的连接,返回真为成功 if objSock.Open then '发出查询 WriteLn表示用vbCrlf终结(strQuery & vbCRlf) objSock.WriteLn strQuery '读取返回值,最大长度为65535 strResult=objSock.ReadBytesAsString(65535) '关闭连接 objSock.Close '打印查询结果,你可以需要对此作些处理 ' Response.Write "<b>查询结果</b><br><textarea rows=10 cols=60>" & strResult & "</textarea>" select case gj case "0" str1=inter(strresult) response.write str1 Response.Write "<b>查询结果</b><br><textarea rows=10 cols=60>" & strResult & "</textarea>" case "1" str1=cnnic(strresult) response.write str1 Response.Write "<b>查询结果</b><br><textarea rows=10 cols=60>" & strResult & "</textarea>" end select end if Set objSock=Nothing
end if
function inter(str) if instr(str,"No match")=0 then response.write "您的域名已经被注册。" else response.write "您的域名没有被注册。" end if end function
function cnnic(str) if instr(str,"%")=0 then response.write "您的域名已经被注册。" else response.write "您的域名没有被注册。" end if end function %>