<%@ Language=VBScript %>
<%
FreeHost_t1=20000
FreeHost_t2=20000
FreeHost_t3=30000
FreeHost_t4=240000

Function RegExpTest(patrn, strng)
  Dim regEx
  Set regEx = New RegExp
  regEx.Pattern = patrn
  regEx.IgnoreCase = False
  RegExpTest = regEx.Test(strng)
End Function 


Response.Expires = -9999 
Function ICPCHECK_B(tar,ref)
Set xml = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
xml.Option(6)=0
xml.setTimeouts FreeHost_t1, FreeHost_t2, FreeHost_t3, FreeHost_t4
xml.Open "GET", tar, False
xml.setRequestHeader "User-Agent","Mozilla/2.0 (compatible; MSIE 5.0B; Windows NT)"
xml.setRequestHeader "Accept-Encoding","none"
xml.setRequestHeader "REFERER",ref
xml.send
session("whois_cookie") = xml.getResponseHeader("Set-Cookie")
session("whois_cookie") =left(session("whois_cookie"),instr(1,session("whois_cookie"),";")-1)
ICPCHECK_B = xml.responsebody
Set xml = Nothing
End Function

Function whoisCHECK(tar,ref)
Set xml = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
xml.Option(6)=0
xml.setTimeouts FreeHost_t1, FreeHost_t2, FreeHost_t3, FreeHost_t4
xml.Open "GET", tar, False
xml.setRequestHeader "User-Agent","Mozilla/2.0 (compatible; MSIE 5.0B; Windows NT)"
xml.setRequestHeader "Accept-Encoding","none"
xml.setRequestHeader "REFERER",ref
xml.send
'session("whois_cookie") = xml.getResponseHeader("Set-Cookie")
'session("whois_cookie") =left(session("whois_cookie"),instr(1,session("whois_cookie"),";")-1)
whoisCHECK = Bytes2bStr_utf(xml.responsebody)
Set xml = Nothing
End Function


Function Bytes2bStr_utf(vin)
  Dim BytesStream,StringReturn
  Set BytesStream = Server.CreateObject("ADODB.Stream")
  BytesStream.Type = 2
  BytesStream.Open
  BytesStream.WriteText vin
  BytesStream.Position = 0
  BytesStream.Charset = "utf-8"
  BytesStream.Position = 2
  StringReturn =BytesStream.ReadText
  BytesStream.close
  Set BytesStream = Nothing
  Bytes2bStr_utf = StringReturn
End Function


domain=trim(Request("domain"))

 
OriDomain=ComX.idntoac_7i24_com(domain)
If OriDomain="" or RegExpTest("[^.A-Za-z0-9--]",OriDomain) Then
response.redirect "e.asp?e=请您输入正确的查询域名！"
End if


'2014

ret=whoisCHECK("https://www.whois.com/whois/"&domain,"https://www.whois.com/")


'Response.write ret&"<br><br><br><br><br>"


aryA=Split(ret,"<div class=""whois_heading"">")
'aryA=Split(ret,"<div class=""whois_heading"" id=""registryData"">")
'<div class="whois_heading">
'aryB=Split(aryA(1),"</div>")

aryB=Split(aryA(1),"</pre></div>")

whoisret1=Replace(aryB(0),"<img src=""/eimg","<img src=""https://www.whois.com/eimg")
'Response.write whoisret1

'Response.write ret&"<br><br><br><br><br>"

If InStr(ret,"<div class=""whois_result"" id=""registrarData"">") then
aryAA=Split(ret,"<div class=""whois_result"" id=""registrarData"">")
aryBB=Split(aryAA(1),"</div>")
whoisret2=Replace(aryBB(0),"<img src=""/eimg","<img src=""https://www.whois.com/eimg")
'Response.write whoisret2
End if
'Response.end

'response.contenttype="image/jpeg"
'Response.BinaryWrite 
'session("whoissession")=ICPCHECK_B("http://www_old.dns.com.cn/mainv2/dauth.php","http://www_old.dns.com.cn/domainv2/domain_whois.php")


'if retdns ="" then Response.Redirect "e.asp?e=数据库忙，不能完成操作，请稍后再试。"


'domain=163.com&auth=3449&file=%2Fmain%2Fpublic_doc.php%3Fdoc%3DDomainReg%2Fwhois&x=41&y=17
'domain=6to23.com&auth=7960&Submit=%CC%E1%BD%BB

%>

<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
Whois
<%=htmlwrite("html3")%>
<br>
<%=whoisret1%>
<br>
<br>
<%=whoisret2%>

<!--<form name="form1" method="post" action="whois2.asp">
  您正在查询域名
    <input name="domain" type="text" value="<%=domain%>" size="20" maxlength="50">
  的whois信息：  <br>
  请输入验证码：<img src="whoisimg.asp">
<input name="auth" type="text" size="4" maxlength="4">
<input type="submit" name="Submit" value="提交">
</form>-->
<%=htmlwrite("html4")%>
