<%@ Language=VBScript %>
<%server.ScriptTimeout =240

dim haveer,domainwhois
session("DomainNameModid")=""
function checkinfo(vDomain)	
haveerr=false
domainwhois=""
On Error Resume Next 
if instr(vDomain,".")>1 then
vDomain=replace(vDomain,".%D6%D0%B9%FA",".cn")
vDomain=replace(vDomain,".%B9%AB%CB%BE",".com.cn")
vDomain=replace(vDomain,".%CD%F8%C2%E7",".net.cn")

 
vDomain=ComX.idntoac_7i24_com(Cstr(vDomain))

domtemp=Right(vDomain,"3")
if domtemp="com" or domtemp="net" or domtemp="org" then id=1
if domtemp=".cn" then id=2
if domtemp="biz" then id=4
if domtemp="nfo" then id=5
if domtemp=".cc" then id=8
if domtemp="obi" then id=9

'whois.pir.org


checkinfo=false

if id=4 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect "whois.biz",43
	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	tempstr =  socket.receive(4192)
	tempstr = tempstr & socket.receive(4192)
	Set socket=nothing

'response.write tempstr
'response.end

	if instr(tempstr,"ot found")>1 or strcomp(trim(left(tempstr,8)),"Not foun")=0 or strcomp(trim(left(tempstr,8)),"No match")=0 or instr(tempstr,"o match for")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
	Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if

if id=9 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect "whois.dotmobiregistry.net",43
	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	tempstr =  socket.receive(4192)
	tempstr = tempstr & socket.receive(4192)
	Set socket=nothing

'response.write tempstr
'response.end


	if instr(tempstr,"OT FOUND")>1 or strcomp(trim(left(tempstr,8)),"Not foun")=0 or strcomp(trim(left(tempstr,8)),"No match")=0 or instr(tempstr,"o match for")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
	Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if

if id=5 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect "whois.afilias.info",43
	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	tempstr =  socket.receive(4192)
	tempstr = tempstr & socket.receive(4192)
	Set socket=nothing

'response.write tempstr
'response.end

	if instr(tempstr,"OT FOUND")>1 or strcomp(trim(left(tempstr,8)),"Not foun")=0 or strcomp(trim(left(tempstr,8)),"No match")=0 or instr(tempstr,"o match for")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
	Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if

if id=8 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect "whois.nic.cc",43
	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	tempstr =  socket.receive(4192)
	tempstr = tempstr & socket.receive(4192)
	Set socket=nothing

'response.write tempstr
'response.end

	if strcomp(trim(left(tempstr,8)),"Not foun")=0 or strcomp(trim(left(tempstr,8)),"No match")=0 or instr(tempstr,"o match for")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
	Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if

if id=1 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect "rs.internic.net",43
	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	tempstr =  socket.receive(4192)
	tempstr = tempstr & socket.receive(4192)
	Set socket=nothing

'response.write tempstr
'response.end

	if strcomp(trim(left(tempstr,8)),"Not foun")=0 or strcomp(trim(left(tempstr,8)),"No match")=0 or instr(tempstr,"o match for")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
	Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if

if id=2 then
	Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 

'vDomain="星外.中国"

	socket.Connect "whois.cnnic.net.cn",43

	socket.SendTimeOut = 30000	
	socket.RecvTimeOut = 30000
	socket.send vDomain&chr(10)&chr(13)
	
	tempstr =  socket.receive(2048)
	tempstr = tempstr & socket.receive(2048)
	Set socket=nothing

'response.write vDomain&" "&tempstr&"<br><br><br><br><br>"
'response.end
	if  instr(tempstr,"o matching record")>1 then
	checkinfo=true
	else
	checkinfo=false
	domainwhois=tempstr
	end if
	if  tempstr="" then
	haveerr=true
		Response.write "查询域名:"&vDomain&"网络出错:请减少同时查询的域名再试。.cn类同时只能查两个类型。<br>"
'	Response.Redirect "e.asp?e=对不起，由于网络原因操作失败，请稍候重试！"&vDomain
	end if
end if


end if

end function

if request.form<>"" then
QueryString=cstr(request.form)
QueryString=replace(request.form,"searchedDomainName=","domain=")
QueryString=replace(QueryString,"&suffix=.com&","&com=yes&")
QueryString=replace(QueryString,"&suffix=.net&","&net=yes&")
QueryString=replace(QueryString,"&suffix=.org&","&org=yes&")
QueryString=replace(QueryString,"&suffix=.com.cn&","&comcn=yes&")
QueryString=replace(QueryString,"&suffix=.net.cn&","&netcn=yes&")
QueryString=replace(QueryString,"&suffix=.org.cn&","&orgcn=yes&")
QueryString=replace(QueryString,"&suffix=.gov.cn&","&govcn=yes&")
QueryString=replace(QueryString,"&suffix=.cn&","&cn=yes&")
QueryString=replace(QueryString,"&suffix=.biz&","&biz=yes&")
QueryString=replace(QueryString,"&suffix=.info&","&info=yes&")
QueryString=replace(QueryString,"suffix=cnaddr&","cnaddr=yes&")
response.Redirect "/style/info/actionbiz.asp?"&QueryString&"&big5=n"
end if

if instr(request.QueryString,"com=yes")>1 or instr(request.QueryString,"net=yes")>1  or instr(request.QueryString,"org=yes")>1 then id=1
if instr(request.QueryString,"cn=yes")>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=9
if request.QueryString("freehosttype")="2" then id=7
if request.QueryString("freehosttype")="3" then id=3
if request.QueryString("freehosttype")="4" then id=6


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

end if
if ds("regapi")=1 then actionurl = "api1domainform.asp"
if ds("regapi")=2 then actionurl = "xindomainform.asp"
if ds("regapi")=3 then actionurl = "actionbiz2.asp"
if ds("regapi")=4 then actionurl = "actionch2.asp"
if ds("regapi")=5 then actionurl = "netdomainform.asp"

end if
ds.close
set ds=nothing
conn.close
set conn=nothing
'if request.QueryString("freehosttype")="2" then Response.Redirect "e.asp?e=很抱歉，接口不支持注册这个类型"
'if request.QueryString("freehosttype")="3" then Response.Redirect "e.asp?e=很抱歉，接口不支持注册这个类型"'将支持
if request.QueryString("freehosttype")="4" then Response.Redirect "e.asp?e=很抱歉，接口不支持注册这个类型"

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

'response.write request.QueryString

arryA=split(request.QueryString,"&")
for i=0 to ubound(arryA)
if instr(arryA(i),"=yes")>1 or instr(arryA(i),"suffix=")>0 then
if instr(arryA(i),"=yes")>1 then domain=request.QueryString("domain")&"."&replace(arryA(i),"=yes","")
if instr(arryA(i),"suffix=")>0 then domain=request.QueryString("domain")&request.QueryString("suffix")
domain=replace(domain,".comcn",".com.cn")
domain=replace(domain,".netcn",".net.cn")
domain=replace(domain,".orgcn",".org.cn")
domain=replace(domain,".govcn",".gov.cn")
domain=replace(domain,".shcn",".sh.cn")
domain=replace(domain,".bjcn",".bj.cn")
domain=replace(domain,".gzcn",".gz.cn")
domain=replace(domain,".fjcn",".fj.cn")
domain=replace(domain,".jscn",".js.cn")
'domain=replace(domain,"%D6%D0%B9%FA","cn")
'domain=replace(domain,"%CD%F8%C2%E7","net.cn")
'domain=replace(domain,"%B9%AB%CB%BE","com.cn")
'response.write domain
'response.end
ret=checkinfo(domain)


enddomain=ComX.actoidc_7i24_com(Cstr(domain))
enddomain=replace(enddomain,"%d6%d0%b9%fa","中国")
enddomain=replace(enddomain,"%b9%ab%cb%be","网络")
enddomain=replace(enddomain,"%cd%f8%c2%e7","公司")
if instr(enddomain,".")>1 then
if haveerr=false then
if ret=false then
%>　　　　 <a href="whois.asp?domain=<%=enddomain%>" target=_blank title=""><font color=black><%=enddomain%> 已被注册</font></a><br>
<%else
canreg=true 
%>　　　<input type=radio name=selectedDomainName value="<%=enddomain%>" checked><%=enddomain%> 可以注册<br>
<%
end if
end if
end if
end if
next 
%>
<%if canreg=true then
%><br><br>
　　　<input type="submit" name="Submit" value="继续注册">
<%end if%>
<br>
<br>
<a href="javascript:history.back();">返回上一页重新查询</a><br>
</form>
<%=htmlwrite("html4")%>
