熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp版域名查詢的數據庫接口

2013-11-13 10:45:55  來源: .NET編程 

  <%  
  on  error  resume  next  
  PRivate  d_exsit  
  Dim  Retrieval  
  Dim  Domain  
  Dim  TakenHTML  
  Function  GetURL(url)  
  Set  Retrieval  =  ServerCreateObject("MicrosoftxmlHTTP")  
  With  Retrieval  
  Open  "GET"  url  False  ""  ""  
  Send  
  GetURL  =  ResponseText  
  End  With  
  Set  Retrieval  =  Nothing  
  End  Function  
  Domain  =  Replace(RequestForm("domain")"www""")  &  ""  &  RequestForm("ext")  
  if  Domain="com"  or  RequestForm("domain")=""  then  
  ResponseWrite  ("<script>alert(看看您什麼忘記填寫了?沒有填寫域名吧?);javascript:historyback()</script>")  
  responseend  
  end  if  
  TakenHTML  =  GetURL("  
  TakenHTML  =  GetURL("  &  Domain)  
  d_exsit=  
  if  InStr(TakenHTML"No  entries")  >    then  
  
  ResponseWrite  Domain  &  "出錯了請返回!<br><br>"  
  else  
  if  InStr(TakenHTML"No  match")  >    then  %>  
  祝賀您您想注冊的域名  <%  =Domain  %>  還沒有被注冊<p><a  href="#"  >  
  點擊這裡開始注冊您的域名</a></p></font>  
  <%  else  %>  
  <font  color="red"><br>很抱歉</font>  您想注冊的域名  <%  =Domain  %>  已經被注冊了!<p></p>請您換個域名再試</font>  
  <form  method="post"  action="searchasp"  name="checkdomain"  id=Form>  
  www<input  type="text"  name="domain"  id=Text>  
  <select  name="ext"  id=Select>  
  <option  value="com"  selected>com</option>  
  <option  value="net">net</option>  
  <option  value="org">org</option>  
  <option  value="comcn">comcn</option>  
  <option  value="netcn">netcn</option>  
  <option  value="orgcn">orgcn</option>  
  <option  value="cc">cc</option>  
  <option  value="tv">tv</option>  
  <option  value="biz">biz</option>  
  <option  value="info">info</option>  
  </select>  
  <input  type="submit"  name="Submit"  value="查詢"  id=Submit  onClick  =  "return  submitchecken();">  
  </form>以下是此域名的詳細注冊信息<BR></font>  
  <table><tr><td><PRE><%  =dowith()  %></PRE></td></tr></table></font>  
  <%  end  if  
  end  if  
  Function  dowith()  
  Dim  lStrURL  
  Dim  pagebefore  
  Dim  pageafter  
  Dim  tempcontent  
  Dim  pagestart  
  Dim  pageend  
  dim  temps  
  pageafter  =  "<PRE>"  
  pagebefore  =  "</PRE>"  
  tempcontent  =  TakenHTML  
  if  d_exsit<>  then  
  pagestart  =  InStr(tempcontent  pageafter)  
  If  pagestart  =    Then  
  dowith  =  "<font  color=""red"">意外的錯誤!</font>"  
  d_exsit  =    
  Exit  Function  
  Else  
  pagestart  =  pagestart  +  Len(pageafter)  +    
  pageend  =  InStr(pagestart  tempcontent  pagebefore)  
  If  pageend  =    Then  
  dowith  =  "<font  color=""red"">意外的錯誤!</font>"  
  d_exsit  =    
  Exit  Function  
  Else  
  pageend  =  pageend    pagestart  得到內容長度  
  tempcontent  =  Mid(tempcontent  pagestart  pageend)  
  End  If  
  End  If      
  Set  pageregexp  =  New  RegExp  
  pageregexpGlobal  =  True  
  pageregexpPattern  =  "<[^>]*>"  
  tempcontent  =  pageregexpReplace(tempcontent  "")  
  Set  pageregexp  =  Nothing  
  dowith  =  tempcontent  
  End  If  
  End  Function  
  %>


From:http://tw.wingwit.com/Article/program/net/201311/14459.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.