<%@ Language=VBScript %>
<%
If Application("api6select")=1 Then response.redirect "/BCD/check/check.asp?"&request.QueryString

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

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


server.ScriptTimeout =240
session("DomainNameModid")=""

id=0

if trim(lcase(request.QueryString("domain")))="com" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="net" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="www" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="org" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="gov" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="hk" then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="tw" then response.redirect "e.asp?e=此域名不能注册！"
if Len(trim(lcase(request.QueryString("domain"))))<2 then response.redirect "e.asp?e=此域名不能注册！"
if InStr(request.QueryString("domain"),".")>0 then response.redirect "e.asp?e=此域名不能注册！"
if trim(lcase(request.QueryString("domain")))="" then response.redirect "e.asp?e=请您输入要查询的域名！"

if instr(request.QueryString,"com=yes&")>1 then id=1
if instr(request.QueryString,"net=yes&")>1  or instr(request.QueryString,"org=yes&")>1 then id=30
if instr(request.QueryString,"cn=yes")>1 or instr(request.QueryString,".cn&")>1 then id=2
if instr(request.QueryString,"mobi=yes")>1 then id=9
if instr(request.QueryString,"biz=yes")>1 then id=4
if instr(request.QueryString,"info=yes")>1 then id=5
if instr(request.QueryString,"cc=yes")>1 then id=8
if instr(request.QueryString,"tv=yes")>1 then id=10
if instr(request.QueryString,"hk=yes")>1 then id=11
if instr(request.QueryString,"tw=yes")>1 then id=12
if instr(request.QueryString,"name=yes")>1 then id=20
'if request.QueryString("freehosttype")="2" then id=7
if request.QueryString("freehosttype")="3" then id=3
if request.QueryString("freehosttype")="4" then id=6

if instr(request.QueryString,"tel=yes")>1 then id=32
if instr(request.QueryString,"&me=yes")>1 then id=31
if instr(request.QueryString,"asia=yes")>1 then id=21
if instr(request.QueryString,"govcn=yes")>1 then id=70

if instr(request.QueryString,"us=yes")>1 then id=27
if instr(request.QueryString,"co=yes")>1 then id=71
if instr(request.QueryString,"cm=yes")>1 then id=72
if instr(request.QueryString,"la=yes")>1 then id=52
if instr(request.QueryString,"im=yes")>1 then id=73
if instr(request.QueryString,"wang=yes")>1 then id=74
if instr(request.QueryString,"top=yes")>1 then id=75
if instr(request.QueryString,"xyz=yes")>1 then id=76
if instr(request.QueryString,"pw=yes")>1 then id=77
if instr(request.QueryString,"in=yes")>1 then id=24

if RegExpTest("[^A-Za-z0-9--]",trim(lcase(request.QueryString("domain")))) then'存在中文
if instr(request.QueryString,"com=yes")>1 or instr(request.QueryString,"net=yes")>1  or instr(request.QueryString,"org=yes")>1 then id=7
if instr(request.QueryString,"cn=yes")>1 or instr(request.QueryString,".cn&")>1 then id=3
if instr(request.QueryString,"mobi=yes")>1 then id=16
if instr(request.QueryString,"biz=yes")>1 then id=13
if instr(request.QueryString,"info=yes")>1 then id=14
if instr(request.QueryString,"cc=yes")>1 then id=15
if instr(request.QueryString,"tv=yes")>1 then id=17
if instr(request.QueryString,"hk=yes")>1 then id=18
if instr(request.QueryString,"tw=yes")>1 then id=19
End if
if id=0 then response.redirect "e.asp?e=请您输入要查询的域名！"
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_DomainProductlist where id="&id
		ds.Open Sql,conn,1,1
if not ds.eof then
if ds("checkapi")<>6 then
if ds("checkapi")=1 then server.Transfer "domaincheckapi1.asp"
if ds("checkapi")=2 then server.Transfer "domaincheckpub.asp"
if ds("checkapi")=3 then server.Transfer "domainchecknet.asp"
if ds("checkapi")=4 then server.Transfer "domainchecknet.asp"
if ds("checkapi")=5 then server.Transfer "domainchecknet.asp"
if ds("checkapi")=6 then server.Transfer "domaincheckapi6.asp"
if ds("checkapi")=7 then server.Transfer "domaincheckapi7.asp"
end If

else
response.redirect "e.asp?e=请您先在管理区--产品管理---域名注册中，设置好域名价格及每种域名类型所用的接口！"
end if
ds.close
set ds=nothing
conn.close
set conn=nothing
%>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
QueryString=cstr(request.QueryString)
QueryString=replace(QueryString,"domain=","name=")
QueryString=replace(QueryString,"Domain=","name=")
QueryString=replace(QueryString,"&com=yes&","&suffix=.com&")
QueryString=replace(QueryString,"&net=yes&","&suffix=.net&")
QueryString=replace(QueryString,"&org=yes&","&suffix=.org&")
QueryString=replace(QueryString,"&comcn=yes&","&suffix=.com.cn&")
QueryString=replace(QueryString,"&netcn=yes&","&suffix=.net.cn&")
QueryString=replace(QueryString,"&orgcn=yes&","&suffix=.org.cn&")
QueryString=replace(QueryString,"&govcn=yes&","&suffix=.gov.cn&")
QueryString=replace(QueryString,"&cn=yes&","&suffix=.cn&")
QueryString=replace(QueryString,"&cc=yes&","&suffix=.cc&")
QueryString=replace(QueryString,"&tv=yes&","&suffix=.tv&")
QueryString=replace(QueryString,"&biz=yes&","&suffix=.biz&")
QueryString=replace(QueryString,"&info=yes&","&suffix=.info&")
QueryString=replace(QueryString,"cnaddr=yes&","suffix=cnaddr&")
QueryString=replace(QueryString,"&mobi=yes&","&suffix=.mobi&")

QueryString=replace(QueryString,"&hk=yes&","&suffix=.hk&")
QueryString=replace(QueryString,"&tw=yes&","&suffix=.tw&")
QueryString=replace(QueryString,"&co=yes&","&suffix=.co&")

QueryString=replace(QueryString,"&tel=yes&","&suffix=.tel&")
QueryString=replace(QueryString,"&me=yes&","&suffix=.me&")
QueryString=replace(QueryString,"&asia=yes&","&suffix=.asia&")

QueryString=replace(QueryString,"&wang=yes&","&suffix=.wang&")
QueryString=replace(QueryString,"&top=yes&","&suffix=.top&")
QueryString=replace(QueryString,"&xyz=yes&","&suffix=.xyz&")
QueryString=replace(QueryString,"&pw=yes&","&suffix=.pw&")
QueryString=replace(QueryString,"&in=yes&","&suffix=.in&")
QueryString=replace(QueryString,"&im=yes&","&suffix=.im&")
QueryString=replace(QueryString,"&la=yes&","&suffix=.la&")
QueryString=replace(QueryString,"&cm=yes&","&suffix=.cm&")
QueryString=replace(QueryString,"&us=yes&","&suffix=.us&")

QueryString=replace(QueryString,"&%D6%D0%B9%FA=yes","&suffix=.%D6%D0%B9%FA")
QueryString=replace(QueryString,"&%CD%F8%C2%E7=yes","&suffix=.%CD%F8%C2%E7")
QueryString=replace(QueryString,"&%B9%AB%CB%BE=yes","&suffix=.%B9%AB%CB%BE")
'                                &%D6%D0%B9%FA=yes&enc=E&client=agent19263

'注意：通用网址suffix=cnaddr
body=QueryString&"&enc=E&client="&Application("Domain_Agent_username_6")
body=Replace(body,"&Submit=++%CC%E1+%BD%BB++","")
body=LCase(Replace(body,"&suffix=&","&"))
'response.write body
'response.end

retdns=ONLY_POST(Application("Domain_Agent_url_6")&"/api/freehost.asp?method=check",Application("Domain_Agent_url_6"),body)


'response.write tran_ado(retdns,"unicode","gb2312")
'response.End
'Response.CharSet="gb2312"
'Response.charset = "gb2312" 
'response.write (retdns)
'response.End



'retdns=trim(retdns)&"&"
'retdns=replace(retdns,vbcrlf,"")
havereg=""
arryhave=""

if instr(retdns,"auth=-1")>0 Or instr(retdns,"verify-failure")>0 Or instr(retdns,"&err=")>0 Then
response.write "请先去兼容api的代理区设置密码，并到平台管理区，系统参数中，设置api的代理号及API密码，出错信息为："&retdns&"<br>可以参考：http://sys.7i24.com/system/support/default.asp?id3=1&id4=2"

'if instr(retdns,"UnAuthIP")>0 Then
'response.write "<br><br>新网的代理区agent.xinnet.com，设置API中的IP不对造成的."
'End if

response.end
end if


if instr(retdns,"num=")>0 and not ( instr(retdns,"&chk1=108")>0  or instr(retdns,"&chk1=113")>0  or instr(retdns,"&chk1=111")>0  or instr(retdns,"&chk1=-108")>0  or instr(retdns,"&chk1=-113")>0  or instr(retdns,"&chk1=-111")>0 ) then
'if instr(retdns,"num=")>0 then

strarryA=split(retdns,"num=")
strarryB=split(strarryA(1),"&enc=")
for i=1 to strarryB(0)
strarryC=split(retdns,"&chk"&i&"=")
strarryD=split(strarryC(0),"&name"&i&"=")
strarryE=split(strarryC(1),"&")

'response.write strarryD(1)
'response.write "<br>"
'response.write strarryE(0)
if left(strarryE(0),1)="0" then
havereg=havereg&" "&trim(strarryD(1))
end if
if left(strarryE(0),3)="100" or left(strarryE(0),3)="110" or left(strarryE(0),3)="108" or left(strarryE(0),3)="113"  or left(strarryE(0),3)="111"  or left(strarryE(0),3)="-110" or left(strarryE(0),3)="-108" or left(strarryE(0),3)="-113"  or left(strarryE(0),3)="-111" then
canreg=canreg&" "&trim(strarryD(1))
end if
next

else
response.Redirect "e.asp?e=出错，代码是："&server.URLEncode (retdns)
end if

%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>　
<%=htmlwrite("html3")%>
<form name="frmsearchedresult" action="xindomainform.asp" method="post">
<%

if havereg<>"" then%><br><br>以下域名已注册了：<br><%
arryhave=split(havereg," ")
for i=0 to ubound(arryhave)%>
　　<a href="whois.asp?domain=<%=arryhave(i)%>" target=_blank><font color=black><%=arryhave(i)%></font></a><br>
<%next
end if
%>
<%if canreg<>"" then%><br><br>以下域名可以继续注册：<br>
<%
arryhave=split(canreg," ")
for i=0 to ubound(arryhave)
if trim(arryhave(i))<>"" then
%>
　　<input type=radio name=selectedDomainName value="<%=arryhave(i)%>" checked><%=arryhave(i)%><br>
<%
end if
next%><br><br>

<%If Application("usercanselectapi")=True Then%>您可以自由选择域名的所属注册商：
<%If Application("api1")=True Then%>
新网互联：<input type="radio" name="usercanselectapi" value="1" checked>　
<%End if%>
<%If Application("api2")=True Then%>
新网：<input type="radio" name="usercanselectapi" value="2" checked>　
<%End if%>
<%If Application("api3")=True Then%>
商务中国：<input type="radio" name="usercanselectapi" value="3" checked>　
<%End if%>
<%If Application("api4")=True Then%>
中国频道：<input type="radio" name="usercanselectapi" value="4" checked>　
<%End if%>
<%If Application("api5")=True Then%>
万网：<input type="radio" name="usercanselectapi" value="5" checked>　
<%End if%>
<%If Application("api6")=True Then%>
其他注册商(API6接口)：<input type="radio" name="usercanselectapi" value="6">　
<%End if%>
<%If Application("api7")=True Then%>
外国接口：<input type="radio" name="usercanselectapi" value="7">　
<%End if%>
<br><br>
<%End if%>

<input type="submit" name="Submit" value="继续注册">
<%end if%>
<br>
<br>
<a href="javascript:history.back();">返回上一页重新查询</a><br>
</form>
<%=htmlwrite("html4")%>
