<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostEmail.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMoney.asp"-->
<%
If session("username")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.QueryString ("id")="" Then
	ef=True
	ec="请输入产品ID！"
ElseIf not IsNumeric(Request.QueryString ("id"))  Then
	ef=True
	ec="ID应该是数字！"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_NetCN where username='"&session ("username")&"' and id='"&Request.QueryString ("id")&"'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="不存在的万网主机！"
end if
end if


If not ef then
	Set dsNetCNpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_NetCNProductlist where productid='"&dsph ("productid")&"'"
	dsNetCNpdlist.Open Sql,conn,1,1
if dsNetCNpdlist.Eof then
	ef=True
	ec="产品不存在！"
End If
End if

if not ef then
Ftppassword=Left(md5(now),8)
			userid=Application("Domain_Agent_username_5")			'万网数字ID
			password		=Application("Domain_Agent_password_5")		'万网数字ID密码
			email			=Application("Domain_Agent_username_5_emamil")	'万网注册email
			vtime			= FormatDate(now())
			userstr			=md5(userid&password&email&vtime)

			category		="host"
			productid		=dsph("productid")
			action			="changepwd"
			
			vsendStr		="userid="&userid&"&userstr="&userstr&"&vtime="&vtime
			
			vsendStr		=vsendStr&"&category="&category
			vsendStr		=vsendStr&"&productid="&productid
			vsendStr		=vsendStr&"&action="&action
			
			vsendStr		=vsendStr&"&hostadminid="&dsph("ftpname")
			vsendStr		=vsendStr&"&password="&Ftppassword

			retdns=LIT_RetrunStr("http://api.hichina.com/wwwnetcn.aspx",vsendStr)
dsph("Ftppassword")=Ftppassword
dsph("retdns")=retdns
dsph.update

End If

if not ef then
			dim returncodevalue,failreason,sucdate,deaddate,hostadminid,hostpassword,volume,ipaddress,dbname,dbpassword,relatedname,os,icpstatus,porflag,idc
			xmlvalue(retdns)
			If Instr(retdns,"200")<=0 Then
				retdns= "返回状态码:"&returncodevalue&" 原因:"&failreason
				ef=True
			End If	
End if

if not ef then

if session("agentusername")<>"" Then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
<%else%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
<%End if%>
　 万网主机类
<%if session("agentusername")<>"" Then%>
<%=htmlwrite("html6")%>
<%else%>
<%=htmlwrite("html3")%>
<%End if%>
<br><br><br>
处理成功：新FTP密码为：<%=Ftppassword%>

<%if session("agentusername")<>"" Then%>
<%=htmlwrite("html7")%>
<%else%>
<%=htmlwrite("html4")%>
<%End if%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
