<%@ Language=VBScript %>
<%
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 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,"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")<>1 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 "actionbiz.asp"
'if ds("checkapi")=4 then server.Transfer "actionch.asp"
if ds("checkapi")=5 then server.Transfer "domainchecknet.asp"
if ds("checkapi")=6 then server.Transfer "domainchecknet.asp"
if ds("checkapi")=7 then server.Transfer "domaincheckapi7.asp"

end if


end if
ds.close
set ds=nothing
conn.close
set conn=Nothing

actionurl = "xindomainform.asp"

server.ScriptTimeout =240
QueryString=cstr(request.QueryString)
QueryString=replace(QueryString,"domain=","Domain=")
QueryString=replace(QueryString,"&com=yes","&CheckBox=.com")
QueryString=replace(QueryString,"&net=yes","&CheckBox=.net")
QueryString=replace(QueryString,"&org=yes","&CheckBox=.org")
QueryString=replace(QueryString,"&comcn=yes","&CheckBox=.com.cn")
QueryString=replace(QueryString,"&netcn=yes","&CheckBox=.net.cn")
QueryString=replace(QueryString,"&orgcn=yes","&CheckBox=.org.cn")
QueryString=replace(QueryString,"&govcn=yes","&CheckBox=.gov.cn")
QueryString=replace(QueryString,"&shcn=yes","&CheckBox=.sh.cn")
QueryString=replace(QueryString,"&bjcn=yes","&CheckBox=.bj.cn")
QueryString=replace(QueryString,"&gzcn=yes","&CheckBox=.gz.cn")
QueryString=replace(QueryString,"&fjcn=yes","&CheckBox=.fj.cn")
QueryString=replace(QueryString,"&jscn=yes","&CheckBox=.js.cn")
QueryString=replace(QueryString,"&cn=yes","&CheckBox=.cn")
QueryString=replace(QueryString,"&biz=yes","&CheckBox=.biz")
QueryString=replace(QueryString,"&cc=yes","&CheckBox=.cc")
QueryString=replace(QueryString,"&tv=yes","&CheckBox=.tv")
QueryString=replace(QueryString,"&info=yes","&CheckBox=.info")
QueryString=replace(QueryString,"&tv=yes","&CheckBox=.tv")
QueryString=replace(QueryString,"&mobi=yes","&CheckBox=.mobi")

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

QueryString=replace(QueryString,"&tel=yes","&CheckBox=.tel")
QueryString=replace(QueryString,"&me=yes","&CheckBox=.me")
QueryString=replace(QueryString,"&asia=yes","&CheckBox=.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,"suffix=","CheckBox=")

QueryString=replace(QueryString,"&%D6%D0%B9%FA=yes","&CheckBox=.中国")
QueryString=replace(QueryString,"&%CD%F8%C2%E7=yes","&CheckBox=.网络")
QueryString=replace(QueryString,"&%B9%AB%CB%BE=yes","&CheckBox=.公司")

'QueryString=QueryString&"&pby=freehost"

'response.write QueryString&"<br>"
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>　域名注册
<%=htmlwrite("html3")%>
<form name="frmsearchedresult" action="<%=actionurl%>" method="post">
<%
if request.QueryString("freehosttype")="4" then Response.Redirect "e.asp?e=很抱歉，接口不支持注册这个类型"

endstr=split(QueryString,"CheckBox")
for ien=0 to ubound(endstr)
enddomain= replace(endstr(ien),"=","")
if instr(enddomain,".")=1 then
endstr2=split(enddomain,"&")
enddomain= replace(endstr2(0),"&","")
domain=request("Domain")&endstr2(0)
'response.write domain&"<br>"
if len(domain)>4 then
'response.write domain&"<br>"
	set oDomain= server.createobject("DevKit.Core.APIDomain")
	oDomain.setAgent Application("Domain_Agent_username_1"),Application("Domain_Agent_password_1_API")
	oDomain.setPostDebug(true)
	oDomain.setDomainName(domain)

	oDomain.setEncode("ENG")

if request.QueryString("freehosttype")="2" then oDomain.setEncode("CHI")
if request.QueryString("freehosttype")="3" then
oDomain.setEncode("CHI")

 
Fdomain=ComX.StoF_7i24_com(domain)
Fdomain=Replace(Fdomain,".中國",".中国")
Fdomain=Replace(Fdomain,".公司",".公司")
Fdomain=Replace(Fdomain,".網絡",".网络")
'		response.write Fdomain
oDomain.setDomainComplex(Fdomain)
end if
'if request.QueryString("freehosttype")="4" then oDomain.setEncode("CHI")

	'执行域名检测
	if oDomain.domainCheck() Then

	canreg=true
		'显示debug信息
'		response.write oDomain.getPostDebug()

'		response.write domain&"可以注册<br>"
%>
         <input type=radio name=selectedDomainName value="<%=domain%>" checked><%=domain%> 可以注册<br>
<%Else
if oDomain.getCode()=1004 or oDomain.getCode()=1005 then
	response.write "请先到新网互联代理区设置好EPP PRO密码，并进入主机平台管理区，系统参数中设置好新网互联的ＡＰＩ参数。出错信息："&oDomain.getMessage()
		Set oDomain = nothing
		response.end
end if
%>
<a href="whois.asp?domain=<%=domain%>" target=_blank title="<%=oDomain.getPostDebug()&oDomain.getCode()&oDomain.getMessage()%>"><font color=black><%=domain%> 不可以注册<br></font></a>
<%
End If

end if
end if
next
	Set oDomain = nothing
if canreg then%>

<%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")%>
