<!--#include file="conn.asp" -->
<% 
on error resume next
domain=trim(request.form("domain"))
domain_len=ubound(Split(domain,"."))
if ubound(Split(domain,"."))>0 then
  if Split(domain,".")(domain_len)="net" or Split(domain,".")(domain_len)="com" or Split(domain,".")(domain_len)="cn" or Split(domain,".")(domain_len)="org" or Split(domain,".")(domain_len)="cc" or Split(domain,".")(domain_len)="tf" then
 
 '域名whios查询开始 
 '------------------------------------------------------------------
 if ubound(Split(domain,"."))=1 then
  domain1=Split(domain,".")(0)
  ext=Split(domain,".")(1)
 else
 domain1=Split(domain,".")(0)
 ext=Split(domain,".")(1)&"."&Split(domain,".")(2)
 end if
 
Information=false
if ext="" or ext=empty then 
domain=domain1
else
domain=domain1&"."&ext
end if

function bytes2bstr(vin)
strreturn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bytes2bstr = strreturn
end function

Function GetURL(url,ext)
    Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
          With Retrieval
          .Open "GET", url, False, "", ""
          .Send
		  if instr(ext,"cn")<>0 then
          GetURL = .responseText
		  else
		  GetURL = .responsebody
		  GetURL= bytes2bstr(GetURL)
		  GetURL=trim(GetURL)
		end if
          End With
    Set Retrieval = Nothing
End Function

 if ext<>"" then
   if ext="com" or ext="net" or ext="org" or ext="biz" or ext="info" then
   			TakenHTML = GetURL("http://www-whois.internic.net/cgi/whois?type=domain&whois_nic=" & Domain,ext)
            pageafter = "<pre>"
			pagebefore = "</pre>"
   end if
   
   if instr(ext,"cn")<>0 then
        TakenHTML = GetURL("http://ewhois.cnnic.net.cn/whois?value="&Domain&"&entity=domain",ext)
		pageafter = "<table border=1 cellspacing=0 cellpadding=2>"
		pagebefore = "</table>"
     end if
	 
  if ext="中国" or ext="公司" or ext="网络" then
        TakenHTML = GetURL("http://cwhois.cnnic.net.cn/whois.jsp?entityname=domain&queryinfo=" &Domain,ext)
        pageafter = "<table border=1 cellspacing=0 cellpadding=2>"
        pagebefore = "</table>"
    end if
	
 else
 
   TakenHTML = GetURL("http://seal.cnnic.net.cn/queryserver?nameInfo=" & Domain & "&entityName=keyword","通用网址")
   pageafter = "<table border=1 cellspacing=0 cellpadding=2>"
   pagebefore = "</table>"
   
end if

  
   tempcontent=TakenHTML
   if TakenHTML="" then
   TakenHTML="查询有错"
   else
    if instr(TakenHTML,"没有被注册")<>0 then
	  TakenHTML="此域名没有被注册"
	  else
       if instr(1,TakenHTML,pageafter,1)<>0 then
          pagestart=InStr(1,tempcontent, pageafter,1)+ Len(pageafter) + 1 
	      pageend=instr(pagestart,tempcontent,pagebefore,1)
	      pageend = pageend - pagestart 
	      TakenHTML = Mid(tempcontent, pagestart, pageend)
		  TakenHTML=pageafter&TakenHTML&pagebefore
      end if
	  
    end if
  end if

 whios=TakenHTML
 '-----------域名查询结束-------------------------------------------
  
  else
  whios="<p align='center'><strong><font size='3'>对不起！！您不能在这里查询此域名...</font></stront></p>"
  end if
else
whios="<p align='center'><strong><font size='3'>对不起！！您的域名非法...</font></stront></p>"
end if

 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=page_title%> 域名 whios查询</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>


<body leftmargin="3" topmargin="0">
<!--#include file="head.asp" -->
<table width="755" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="755" height="19" valign="bottom"><font color="#990000">　→ </font>你当前位置：<a href="default.asp">首 
      页 </a>&gt;&gt;域名whios查询</td>
  </tr>
  <tr>
    <td height="1" background="images/2.jpg"></td>
  </tr>
</table>
<table width="763" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="183" valign="top"> <div align="center"><img src="img1/host.gif" width="140" height="80"> 
        <!--#include file="in.asp" -->
        <!--#include file="helt_inc.asp" --></p>
        </div></td>
    <td width="1" bgcolor="#ECF9FF"> </td>
    <td width="579" valign="top"><table width="86%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td><p align="center">&nbsp;</p>
            <p align="center">&nbsp;</p>
            <p><%= whios %></p></td>
        </tr>
      </table></td>
  </tr>
</table>
<%
call CloseDatabase '关闭数据库链接
%>
<!--#include file="top.asp" -->
</body>
</html>





























