<%
Dim socket,ZPEF,ZPEC,ZPsend,ZPret,contactid

'temp2=ZP_logout

public function TOLOGINZP()
ZP_new "cp.35.com","30008"
ZP_login()
TOLOGINZP=ZPEF
end Function

function ZP_new(host,port)
Set socket = CreateObject("ASPSocket.MySocket")
	socket.Create 
	socket.Connect host,port 
	socket.SendTimeOut = 10000
	socket.RecvTimeOut = 10000
	socket.receive(2048)
end Function

sub ZP_end()
socket.close
end Sub

sub ZPdoend()
if InStr(ZPret,"<code>1000</code>") then
ZPEC=""
ZPEF=false
else
ZPEF=True
ZPEC=ZPret
end if
end sub

public function ZP_login()
dim cltrid
cltrid=cltrid_new()
ZPsend="<?xml version=""1.0"" encoding=""UTF-8"" standalone=""no""?>"&vbcrlf
ZPsend=ZPsend&"<request><category>client</category><action>Login</action>"&vbcrlf
ZPsend=ZPsend&"<params><param name=""clid"">"&Application("Domain_Agent_username_4")&"</param></params>"&vbcrlf
ZPsend=ZPsend&"<cltrid>"&cltrid&"</cltrid><chksum>"&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&cltrid&"login")&"</chksum></request>"&vbcrlf
socket.send ZPsend 
ZPret=socket.receive(len(ZPsend)*2)
ZPdoend
ZP_login=ZPret
end Function

function ZP_logout()
dim cltrid
cltrid=cltrid_new()
ZPsend = "<?xml version=""1.0""encoding=""UTF-8"" standalone=""no""?>"&vbcrlf
ZPsend = ZPsend&"<request><category>client</category><action>Logout</action><params><param name=""clid"">"&Application("Domain_Agent_username_4")&"</param>"&vbcrlf
ZPsend = ZPsend&"<cltrid>"&cltrid&"</cltrid>"&vbcrlf
ZPsend = ZPsend&"<chksum>"&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&cltrid&"logout")&"</chksum></request>"&vbcrlf
 socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
ZP_end'结束socket
ZP_logout=ZPret
end function

function cltrid_new()
Randomize
ZPRkey=CLng((100000000 - 20 + 7850) * Rnd + 100)
cltrid_new=now&" "&ZPRkey
end Function



public function ZP_create_contactor(domain,contacttype,org,org_m,name,name_m,province,city,street,city_m,street_m,postalcode,voice,fax,email,AppPurpose,NexusCategory,password)
dim clTRID
cltrid=cltrid_new()
province_m=province
province_m=Replace(province_m,"Beijing","北京")
province_m=Replace(province_m,"Hongkong","香港")
province_m=Replace(province_m,"Aomen","澳门")
province_m=Replace(province_m,"Taiwan","台湾")
province_m=Replace(province_m,"Shanghai","上海")
'province_m=Replace(province_m,"深圳","SZ")
province_m=Replace(province_m,"Guangdong","广东")
province_m=Replace(province_m,"Shandong","山东")
province_m=Replace(province_m,"Sichuan","四川")
province_m=Replace(province_m,"Fujian","福建")
province_m=Replace(province_m,"Jiangsu","江苏")
province_m=Replace(province_m,"Zhejiang","浙江")
province_m=Replace(province_m,"Tianjin","天津")
province_m=Replace(province_m,"Chongqing","重庆")
province_m=Replace(province_m,"Hebei","河北")
province_m=Replace(province_m,"Henan","河南")
province_m=Replace(province_m,"Heilongjiang","黑龙江")
province_m=Replace(province_m,"Jinlin","吉林")
province_m=Replace(province_m,"Liaoning","辽宁")
province_m=Replace(province_m,"Neimenggu","内蒙古")
province_m=Replace(province_m,"Hainan","海南")
province_m=Replace(province_m,"Shanxi3","山西")'注意
province_m=Replace(province_m,"Shanxi","陕西")'注意
province_m=Replace(province_m,"Anhui","安徽")
province_m=Replace(province_m,"Jiangxi","江西")
province_m=Replace(province_m,"Gansu","甘肃")
province_m=Replace(province_m,"Xinjiang","新疆")
province_m=Replace(province_m,"Hubei","湖北")
province_m=Replace(province_m,"Hunan","湖南")
province_m=Replace(province_m,"Yunnan","云南")
province_m=Replace(province_m,"Guangxi","广西")
province_m=Replace(province_m,"Ningxia","宁夏")
province_m=Replace(province_m,"Guizhou","贵州")
province_m=Replace(province_m,"Qinghai","青海")
province_m=Replace(province_m,"Xizang","西藏")
ZPsend = "<?xml version=""1.0"" ?>"&vbcrlf
ZPsend = ZPsend&"<request><category>domain</category><action>CreateContact</action>"&vbcrlf
ZPsend = ZPsend&"<params><param name=""domaintype"">"&ZP_domaintype(domain)&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""domain"">"&domain&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""contacttype"">"&contacttype&"</param>"&vbcrlf

ZPsend = ZPsend&"<param name=""postalcode"">"&postalcode&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""voice"">"&voice&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""fax"">"&fax&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""email"">"&email&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""AppPurpose"">"&apppurpose&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""NexusCategory"">"&nexuscategory&"</param>"&vbcrlf

If ZP_domaintype(domain)=220 Or ZP_domaintype(domain)=200 then
ZPsend = ZPsend&"<param name=""name"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org"">"&name_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country"">CN</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province"">"&province_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city"">"&city_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street"">"&street_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""manager"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""industry"">S12</param>"&vbcrlf
Else
ZPsend = ZPsend&"<param name=""name"">"&name&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""name_m"">"&name_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org"">"&org&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org_m"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country"">CN</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province"">"&province&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city"">"&city&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street"">"&street&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country_m"">中国</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province_m"">"&province_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city_m"">"&city_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street_m"">"&street_m&"</param>"&vbcrlf
End If

ZPsend = ZPsend&"<param name=""password"">"&password&"</param><cltrid>"&clTRID&"</cltrid><chksum>"
ZPsend = ZPsend&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&clTRID&"crtcontact"&domain&org&email)&"</chksum></request>"
socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
If ZPEF=False Then contactid=ZP_Find_CID(ZPret)
ZP_create_contactor=ZPret
end function

public function ZP_update_contactor(domain,contacttype,org,org_m,name,name_m,province,city,street,city_m,street_m,postalcode,voice,fax,email,AppPurpose,NexusCategory,password)
dim clTRID
cltrid=cltrid_new()

province_m=province
province_m=Replace(province_m,"Beijing","北京")
province_m=Replace(province_m,"Hongkong","香港")
province_m=Replace(province_m,"Aomen","澳门")
province_m=Replace(province_m,"Taiwan","台湾")
province_m=Replace(province_m,"Shanghai","上海")
'province_m=Replace(province_m,"深圳","SZ")
province_m=Replace(province_m,"Guangdong","广东")
province_m=Replace(province_m,"Shandong","山东")
province_m=Replace(province_m,"Sichuan","四川")
province_m=Replace(province_m,"Fujian","福建")
province_m=Replace(province_m,"Jiangsu","江苏")
province_m=Replace(province_m,"Zhejiang","浙江")
province_m=Replace(province_m,"Tianjin","天津")
province_m=Replace(province_m,"Chongqing","重庆")
province_m=Replace(province_m,"Hebei","河北")
province_m=Replace(province_m,"Henan","河南")
province_m=Replace(province_m,"Heilongjiang","黑龙江")
province_m=Replace(province_m,"Jinlin","吉林")
province_m=Replace(province_m,"Liaoning","辽宁")
province_m=Replace(province_m,"Neimenggu","内蒙古")
province_m=Replace(province_m,"Hainan","海南")
province_m=Replace(province_m,"Shanxi3","山西")'注意
province_m=Replace(province_m,"Shanxi","陕西")'注意
province_m=Replace(province_m,"Anhui","安徽")
province_m=Replace(province_m,"Jiangxi","江西")
province_m=Replace(province_m,"Gansu","甘肃")
province_m=Replace(province_m,"Xinjiang","新疆")
province_m=Replace(province_m,"Hubei","湖北")
province_m=Replace(province_m,"Hunan","湖南")
province_m=Replace(province_m,"Yunnan","云南")
province_m=Replace(province_m,"Guangxi","广西")
province_m=Replace(province_m,"Ningxia","宁夏")
province_m=Replace(province_m,"Guizhou","贵州")
province_m=Replace(province_m,"Qinghai","青海")
province_m=Replace(province_m,"Xizang","西藏")
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> <request> <category>domain</category> <action>UpdateContact</action> <params> 
'<param name="domaintype">0</param> <param name="domain">menmen3.com</param> <param name="contacttype">tech</param> 
'<param name="name">chenyan</param> <param name="org">35</param> <param name="country">CN</param> <param name="province">fujian</param> <param name="city">xiamen</param> <param name="street">fujian xiamen</param> <param name="postalcode">361104</param> <param name="voice">+1.3950160530</param> <param name="fax">+1.3950160530</param> <param name="email">chenyan2@163.com</param> </params> '<cltrid>150132A1239072576B873</cltrid> <chksum>399b636783bee28bc3a49fc5785d6d20</chksum> </request>

ZPsend = "<?xml version=""1.0"" ?>"&vbcrlf
ZPsend = ZPsend&"<request><category>domain</category><action>UpdateContact</action>"&vbcrlf
ZPsend = ZPsend&"<params><param name=""domaintype"">"&ZP_domaintype(domain)&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""domain"">"&domain&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""contacttype"">"&contacttype&"</param>"&vbcrlf

ZPsend = ZPsend&"<param name=""postalcode"">"&postalcode&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""voice"">"&voice&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""fax"">"&fax&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""email"">"&email&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""AppPurpose"">"&apppurpose&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""NexusCategory"">"&nexuscategory&"</param>"&vbcrlf

If ZP_domaintype(domain)=220 Or ZP_domaintype(domain)=200 then
ZPsend = ZPsend&"<param name=""name"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org"">"&name_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country"">CN</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province"">"&province_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city"">"&city_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street"">"&street_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""manager"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""industry"">S12</param>"&vbcrlf
Else
ZPsend = ZPsend&"<param name=""name"">"&name&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""name_m"">"&name_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org"">"&org&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""org_m"">"&org_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country"">CN</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province"">"&province&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city"">"&city&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street"">"&street&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""country_m"">中国</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""province_m"">"&province_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""city_m"">"&city_m&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""street_m"">"&street_m&"</param>"&vbcrlf
End If


ZPsend = ZPsend&"<param name=""password"">"&password&"</param><cltrid>"&clTRID&"</cltrid><chksum>"
ZPsend = ZPsend&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&clTRID&"updatecontact"&domaintype&domain&contacttype)&"</chksum></request>"
socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
ZP_update_contactor=ZPret
end function


public function ZP_create_domain(domain,mltype,period,ns1,ns2,registrant,admin,tech,billing,password)
dim clTRID
ZPret=""
cltrid=cltrid_new()
ZPsend = "<?xml version=""1.0""?><request><category>domain</category><action>CreateDomain</action>"&vbcrlf
ZPsend = ZPsend&"<params><param name=""domaintype"">"&ZP_domaintype(domain)&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""mltype"">"&mltype&"</param><param name=""selltype"">"&selltype&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""domain"">"&domain&"</param><param name=""period"">"&period&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""dns"">"&ns1&"</param><param name=""dns"">"&ns2&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""registrant"">"&registrant&"</param><param name=""tech"">"&tech&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""billing"">"&billing&"</param><param name=""admin"">"&admin&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""password"">"&password&"</param></params><cltrid>"&clTRID&"</cltrid><chksum>"
ZPsend = ZPsend&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&cltrid&"createdomain"&ZP_domaintype(domain)&domain&period&ns1&ns2&registrant&admin&tech&billing&password)&"</chksum></request>"
socket.send ZPsend
ZPret=socket.receive(2048)
'response.Write (ZPret)
ZPdoend
If ZPEF=False Then contactid=ZP_Find_CID(ZPret)
ZP_create_domain=ZPret
end function



function  ZP_password(domain,password)

domain=ComX.idntoac_7i24_com(Cstr(domain))
dim clTRID
ZPret=""
cltrid=cltrid_new()
ZPsend = "<?xml version=""1.0"" ?>"
ZPsend = ZPsend&"<request><category>domain</category><action>UpdateDomainPwd</action>"&vbcrlf
ZPsend = ZPsend&"<params><param name=""domaintype"">"&ZP_domaintype(domain)&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""domain"">"&domain&"</param>"&vbcrlf
ZPsend = ZPsend&"<param name=""password"">"&password&"</param>"&vbcrlf
ZPsend = ZPsend&"</params><cltrid>"&clTRID&"</cltrid><chksum>"
ZPsend = ZPsend&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&clTRID&"updatedomainpwd"&ZP_domaintype(domain)&domain&password)&"</chksum></request>"
'response.Write (ZPsend)
'response.end
socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
ZP_password=ZPret
end function


function ZP_check_domain(name)
dim clTRID
ZPret=""
cltrid=cltrid_new()
ZPsend = "<?xml version=""1.0""?>"
ZPsend = ZPsend&"<request><category>domain</category><action>CheckDomain</action>"
ZPsend = ZPsend&"<params><param name=""domaintype"">"&vartype&"</param>"
ZPsend = ZPsend&"<param name=""domain"">"&name&"</param></params>"
ZPsend = ZPsend&"<cltrid>"&cltrid&"</cltrid>"
ZPsend = ZPsend&"<chksum>"&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&cltrid&"checkdomain"&vartype&name)&"</chksum></request>"
socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
'If ZPEF=False Then contactid=ZP_Find_CID(ZPret)
ZP_check_domain=ZPret
end function

function ZP_renew_domain(domain,period)

domain=ComX.idntoac_7i24_com(Cstr(domain))
dim clTRID
ZPret=""
cltrid=cltrid_new()
ZPsend = "<?xml version=""1.0"" ?>"
ZPsend = ZPsend&"<request><category>domain</category><action>RenewDomain</action>"
ZPsend = ZPsend&"<params><param name=""domaintype"">"&ZP_domaintype(domain)&"</param>"
ZPsend = ZPsend&"<param name=""domain"">"&domain&"</param>"
ZPsend = ZPsend&"<param name=""period"">"&period&"</param>"
ZPsend = ZPsend&"</params><cltrid>"&clTRID&"</cltrid><chksum>"
ZPsend = ZPsend&md5(Application("Domain_Agent_username_4")&md5(Application("Domain_Agent_password_4"))&clTRID&"renewdomain"&ZP_domaintype(domain)&domain&period)&"</chksum></request>"
socket.send ZPsend
ZPret=socket.receive(2048)
ZPdoend
ZP_renew_domain=ZPret
end function

'域名类型
FUnction ZP_domaintype (domain)
	if Enddomaintypeid=3 then
		ZP_domaintype=200
	elseif Enddomaintypeid=2 then
		ZP_domaintype=220
	elseif Enddomaintypeid=26 then
		ZP_domaintype=301
	elseif Enddomaintypeid=10 then
		ZP_domaintype=400
	elseif Enddomaintypeid=8  then
		ZP_domaintype=600
	elseif Enddomaintypeid=15  then
		ZP_domaintype=610
	elseif Enddomaintypeid=4  then
		ZP_domaintype=800
	elseif Enddomaintypeid=13  then
		ZP_domaintype=810
	elseif Enddomaintypeid=5  then
		ZP_domaintype=805
	elseif Enddomaintypeid=27  then
		ZP_domaintype=806
	elseif Enddomaintypeid=24  then
		ZP_domaintype=808
	elseif Enddomaintypeid=28  then
		ZP_domaintype=902
	elseif Enddomaintypeid=9  then
		ZP_domaintype=903
	elseif Enddomaintypeid=21  then
		ZP_domaintype=905
	elseif Enddomaintypeid=31  then
		ZP_domaintype=906
	elseif Enddomaintypeid=70  then
		ZP_domaintype=220
	elseif Enddomaintypeid=30 And right(domain,4)=".org" then
		ZP_domaintype=807
	else
		ZP_domaintype=0
	end if
End Function

function ZP_Find_CID(source_str)
dim zptemp_tart,temp_end
zptemp_tart=instr(1,source_str,"<data name=""contactid"">",1)
temp_end=instr(1,source_str,"</data>",1)
ZP_Find_CID=mid(source_str,zptemp_tart+23,temp_end-zptemp_tart-23)
end function
%>
