<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("cannextagn")="" Then
	ef=True
	ec="您没有此操作的权限。"
elseIf Request.Form ("username")="" or RegExpTest("[^A-Za-z0-9]",Request.Form ("username")) Then
	ef=True
	ec="会员名没有写/或会员名中有非法字符！"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsagX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent where username='"&Request.Form ("username")&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"')"
if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagX.Open Sql,conn,1,3
if dsagX.eof then
	ef=True
	ec="代理会员不存在！"
end if
end If

if not ef then
  Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&session("agentusername")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagent.Open Sql,conn,1,3
If dsagent.Eof Then
		ef=True
		ec="代理会员名不存在！"
end if
end If

if not ef then
If request.Form("pricetempsave")="yes" Then
If request.Form("pricetempname")="" Then
		ef=True
		ec="您选择了保存为价格模板,请填写价格模板的名称!"
End if
End If
End if

if not ef then
if 	LCASE(trim(session("agentusername")))=LCASE(trim(dsagX("username"))) then
	ef=True
	ec="不能设置自己"
end if
end if

if not ef then
	Set dsagnettype = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"&session("agenttype")&"'" 
				if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagnettype.Open Sql,conn,1,1
if dsagnettype.eof then
	ef=True
	ec="代理类型折扣为空，请先设置它！"
end if
end if

if not ef then
for i=1 to 500

if Request.Form ("host"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='虚拟主机' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew


Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_HostProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='虚拟主机' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
realcost=dsDlist("usermoney")*dsagnettype("pers")
else
realcost=dsagnpri("usermoney")
end if
dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("host"&i)) or CDbl(Request.Form ("host"&i))<realcost Then
Response.Write "虚拟主机类别:存在不正常的金额！注意不能小于成本价。"&CDbl(Request.Form ("host"&i))&"元小于成本价,产品编号:"&i
Response.End
end if


ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="虚拟主机"
ds("usermoney")=Request.Form ("host"&i)
ds.Update
ds.Close
end if

if Request.Form ("email"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='邮箱产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_EmailProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='邮箱产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
realcost=dsDlist("usermoney")*dsagnettype("pers")
else
realcost=dsagnpri("usermoney")
end if
dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("email"&i)) or CDbl(Request.Form ("email"&i))<realcost Then
Response.Write "邮箱产品类别:存在不正常的金额！注意不能小于成本价。"&CDbl(Request.Form ("email"&i))&"元小于成本价,产品编号:"&i
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="邮箱产品"
ds("usermoney")=Request.Form ("email"&i)
ds.Update
ds.Close
end if

if Request.Form ("VPS"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='云服务器产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='云服务器产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
realcost=dsDlist("usermoney")*dsagnettype("pers")
else
realcost=dsagnpri("usermoney")
end if
dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("VPS"&i)) or CDbl(Request.Form ("VPS"&i))<realcost Then
Response.Write "云服务器产品类别:存在不正常的金额！注意不能小于成本价。"&CDbl(Request.Form ("VPS"&i))&"元小于成本价,产品编号:"&i
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="云服务器产品"
ds("usermoney")=Request.Form ("VPS"&i)
ds.Update
ds.Close
end if


if Request.Form ("CDN"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='CDN产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_CDNProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='CDN产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
realcost=dsDlist("usermoney")*dsagnettype("pers")
else
realcost=dsagnpri("usermoney")
end if
dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("CDN"&i)) or CDbl(Request.Form ("CDN"&i))<realcost Then
Response.Write "CDN产品类别:存在不正常的金额！注意不能小于成本价。"&CDbl(Request.Form ("CDN"&i))&"元小于成本价,产品编号:"&i
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="CDN产品"
ds("usermoney")=Request.Form ("CDN"&i)
ds.Update
ds.Close
end if


if Application("domaincansetM")=true Then
'独立接口价
For api=1 To 7
If Application("showapi"&api)=True then'是否显示这个接口价格

if Request.Form ("domain"&i&"API"&api)<>"" and Request.Form ("domain"&i&"API"&api)>=0 then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_DomainProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then

realcostrepay=dsDlist("usermoneyagnrepay")
realcostrepay2=dsDlist("usermoneyagnrepay2")
realcostrepay3=dsDlist("usermoneyagnrepay3")
realcostrepay4=dsDlist("usermoneyagnrepay4")
realcostrepay5=dsDlist("usermoneyagnrepay5")
realcostrepay6=dsDlist("usermoneyagnrepay6")
realcostrepay7=dsDlist("usermoneyagnrepay7")

'realcost=dsDlist("usermoneyagn")
'realcostyear2=dsDlist("year2agn")
'realcostyear3=dsDlist("year3agn")
'realcostyear4=dsDlist("year4agn")
'realcostyear5=dsDlist("year5agn")

realcost=dsDlist("usermoneyagn"&"API"&api)
realcostyear2=dsDlist("year2agn"&"API"&api)
realcostyear3=dsDlist("year3agn"&"API"&api)
realcostyear4=dsDlist("year4agn"&"API"&api)
realcostyear5=dsDlist("year5agn"&"API"&api)

else

realcostrepay=dsagnpri("usermoneyrepay")
realcostrepay2=dsagnpri("usermoneyrepay2")
realcostrepay3=dsagnpri("usermoneyrepay3")
realcostrepay4=dsagnpri("usermoneyrepay4")
realcostrepay5=dsagnpri("usermoneyrepay5")
realcostrepay6=dsagnpri("usermoneyrepay6")
realcostrepay7=dsagnpri("usermoneyrepay7")

'realcost=dsagnpri("usermoney")
'realcostyear2=dsagnpri("year2")
'realcostyear3=dsagnpri("year3")
'realcostyear4=dsagnpri("year4")
'realcostyear5=dsagnpri("year5")

realcost=dsagnpri("usermoney"&"API"&api)
realcostyear2=dsagnpri("year2"&"API"&api)
realcostyear3=dsagnpri("year3"&"API"&api)
realcostyear4=dsagnpri("year4"&"API"&api)
realcostyear5=dsagnpri("year5"&"API"&api)
end If

If IsNull(realcost) Then realcost=dsDlist("usermoneyagn"&"API"&api)
If IsNull(realcostyear2) Then realcostyear2=dsDlist("year2agn"&"API"&api)
If IsNull(realcostyear3) Then realcostyear3=dsDlist("year3agn"&"API"&api)
If IsNull(realcostyear4) Then realcostyear4=dsDlist("year4agn"&"API"&api)
If IsNull(realcostyear5) Then realcostyear5=dsDlist("year5agn"&"API"&api)

If IsNull(realcost) Then realcost=dsagnpri("usermoney")
'If IsNull(realcostyear2) Then realcostyear2=dsagnpri("year2")
'If IsNull(realcostyear3) Then realcostyear3=dsagnpri("year3")
'If IsNull(realcostyear4) Then realcostyear4=dsagnpri("year4")
'If IsNull(realcostyear5) Then realcostyear5=dsagnpri("year5")


dsagnpri.close
dsDlist.close

If not IsNumeric(Request.Form ("domain"&i&"API"&api)) or CDbl(Request.Form ("domain"&i&"API"&api))<realcost or CDbl(Request.Form ("domain"&i&"API"&api))<0.01 Then
Response.Write "存在不正常的金额！注意域名不能小于成本价("&api&")。(域名编号:"&i&")"&realcost&"/"&CDbl(Request.Form ("domain"&i&"API"&api))
Response.End
end if

If (not IsNumeric(Request.Form ("domainrepay"&i)) or CDbl(Request.Form ("domainrepay"&i))<realcostrepay or CDbl(Request.Form ("domainrepay"&i))<0.01) And CDbl(Request.Form ("domainrepay"&i))>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价("&api&")。(域名编号:"&i&")"&CDbl(Request.Form ("domainrepay"&i))
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_2")) or CDbl(Request.Form ("domainrepay"&i&"_2"))<realcostrepay2) and Request.Form ("domainrepay"&i&"_2")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_2"))&"元/成本"&realcostrepay2&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_3")) or CDbl(Request.Form ("domainrepay"&i&"_3"))<realcostrepay3) And Request.Form ("domainrepay"&i&"_3")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_3"))&"元/成本"&realcostrepay3&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_4")) or CDbl(Request.Form ("domainrepay"&i&"_4"))<realcostrepay4) And Request.Form ("domainrepay"&i&"_4")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_4"))&"元/成本"&realcostrepay4&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_5")) or CDbl(Request.Form ("domainrepay"&i&"_5"))<realcostrepay5) And Request.Form ("domainrepay"&i&"_5")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_5"))&"元/成本"&realcostrepay5&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_6")) or CDbl(Request.Form ("domainrepay"&i&"_6"))<realcostrepay6) And Request.Form ("domainrepay"&i&"_6")>0 Then
Response.Write "api6存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_6"))&"元/成本"&realcostrepay6&"元"
Response.End
end If

If (not IsNumeric(Request.Form ("domainrepay"&i&"_7")) or CDbl(Request.Form ("domainrepay"&i&"_7"))<realcostrepay7) And Request.Form ("domainrepay"&i&"_7")>0 Then
Response.Write "api7存在不正常的金额！注意域名续费不能小于成本价("&api&")(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_7"))&"元/成本"&realcostrepay7&"元"
Response.End
end if

If not IsNumeric(Request.Form ("domain"&i&"year2"&"API"&api)) or CDbl(Request.Form ("domain"&i&"year2"&"API"&api))<realcostyear2 Then
Response.Write "存在不正常的金额！注意不能小于成本价(2年)("&api&")(域名编号:"&i&")。"&CDbl(Request.Form ("domain"&i&"year2"&"API"&api))&"元/成本"&realcostyear2&"元"
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year3"&"API"&api)) or CDbl(Request.Form ("domain"&i&"year3"&"API"&api))<realcostyear3 Then
Response.Write "存在不正常的金额！注意不能小于成本价(3年)("&api&")(域名编号:"&i&")。"&CDbl(Request.Form ("domain"&i&"year3"&"API"&api))&"元/成本"&realcostyear3&"元"
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year4"&"API"&api)) or CDbl(Request.Form ("domain"&i&"year4"&"API"&api))<realcostyear4 Then
Response.Write "存在不正常的金额！注意不能小于成本价(4年)("&api&")(域名编号:"&i&")。"&CDbl(Request.Form ("domain"&i&"year4"&"API"&api))&"元/成本"&realcostyear4&"元"
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year5"&"API"&api)) or CDbl(Request.Form ("domain"&i&"year5"&"API"&api))<realcostyear5 Then
Response.Write "存在不正常的金额！注意不能小于成本价(5年)("&api&")(域名编号:"&i&")。"&CDbl(Request.Form ("domain"&i&"year5"&"API"&api))&"元/成本"&realcostyear5&"元"
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="域名产品"

If Request.Form ("domainrepay"&i)>0 Then ds("usermoneyrepay")=Request.Form ("domainrepay"&i)
If Request.Form ("domainrepay"&i&"_2")>0 Then ds("usermoneyrepay2")=Request.Form ("domainrepay"&i&"_2")
If Request.Form ("domainrepay"&i&"_3")>0 Then ds("usermoneyrepay3")=Request.Form ("domainrepay"&i&"_3")
If Request.Form ("domainrepay"&i&"_4")>0 Then ds("usermoneyrepay4")=Request.Form ("domainrepay"&i&"_4")
If Request.Form ("domainrepay"&i&"_5")>0 Then ds("usermoneyrepay5")=Request.Form ("domainrepay"&i&"_5")
If Request.Form ("domainrepay"&i&"_6")>0 Then ds("usermoneyrepay6")=Request.Form ("domainrepay"&i&"_6")
If Request.Form ("domainrepay"&i&"_7")>0 Then ds("usermoneyrepay7")=Request.Form ("domainrepay"&i&"_7")

'ds("usermoney")=Request.Form ("domain"&i)
'ds("year2")=Request.Form ("domain"&i&"year2")
'ds("year3")=Request.Form ("domain"&i&"year3")
'ds("year4")=Request.Form ("domain"&i&"year4")
'ds("year5")=Request.Form ("domain"&i&"year5")

ds("usermoneyAPI"&api)=trim(Request.Form("domain"&ds("id")&"API"&api))
ds("year2API"&api)=trim(Request.Form("domain"&ds("id")&"year2API"&api))
ds("year3API"&api)=trim(Request.Form("domain"&ds("id")&"year3API"&api))
ds("year4API"&api)=trim(Request.Form("domain"&ds("id")&"year4API"&api))
ds("year5API"&api)=trim(Request.Form("domain"&ds("id")&"year5API"&api))

ds.Update
ds.Close
end If

End if' 不显示这个接口价格

next'API1-6


Else'没有设置不同价

if Request.Form ("domain"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_DomainProductlist where id="&i
		dsDlist.Open Sql,conn,1,1

realcost=dsDlist("usermoneyagn")
realcostrepay=dsDlist("usermoneyagnrepay")
realcostrepay2=dsDlist("usermoneyagnrepay2")
realcostrepay3=dsDlist("usermoneyagnrepay3")
realcostrepay4=dsDlist("usermoneyagnrepay4")
realcostrepay5=dsDlist("usermoneyagnrepay5")
realcostrepay6=dsDlist("usermoneyagnrepay6")
realcostrepay7=dsDlist("usermoneyagnrepay7")

realcostyear2=dsDlist("year2agn")
realcostyear3=dsDlist("year3agn")
realcostyear4=dsDlist("year4agn")
realcostyear5=dsDlist("year5agn")

Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='域名产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if Not dsagnpri.eof then

If Not IsNull(dsagnpri("usermoney")) Then realcost=dsagnpri("usermoney")
If Not IsNull(dsagnpri("usermoneyrepay")) Then realcostrepay=dsagnpri("usermoneyrepay")
If Not IsNull(dsagnpri("usermoneyrepay2")) Then realcostrepay2=dsagnpri("usermoneyrepay2")
If Not IsNull(dsagnpri("usermoneyrepay3")) Then realcostrepay3=dsagnpri("usermoneyrepay3")
If Not IsNull(dsagnpri("usermoneyrepay4")) Then realcostrepay4=dsagnpri("usermoneyrepay4")
If Not IsNull(dsagnpri("usermoneyrepay5")) Then realcostrepay5=dsagnpri("usermoneyrepay5")
If Not IsNull(dsagnpri("usermoneyrepay6")) Then realcostrepay6=dsagnpri("usermoneyrepay6")
If Not IsNull(dsagnpri("usermoneyrepay7")) Then realcostrepay7=dsagnpri("usermoneyrepay7")
If Not IsNull(dsagnpri("year2")) Then realcostyear2=dsagnpri("year2")
If Not IsNull(dsagnpri("year3")) Then realcostyear3=dsagnpri("year3")
If Not IsNull(dsagnpri("year4")) Then realcostyear4=dsagnpri("year4")
If Not IsNull(dsagnpri("year5")) Then realcostyear5=dsagnpri("year5")

end If



dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("domain"&i)) or CDbl(Request.Form ("domain"&i))<realcost Then
Response.Write "域名类别:存在不正常的金额！注意不能小于成本价(x1)。"&CDbl(Request.Form ("domain"&i))&"元小于成本价,产品编号:"&i
Response.End
end if

If (not IsNumeric(Request.Form ("domainrepay"&i)) or CDbl(Request.Form ("domainrepay"&i))<realcostrepay or CDbl(Request.Form ("domainrepay"&i))<0.01) And CDbl(Request.Form ("domainrepay"&i))>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay1-(域名编号:"&i&")"&CDbl(Request.Form ("domainrepay"&i))
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_2")) or CDbl(Request.Form ("domainrepay"&i&"_2"))<realcostrepay2) and Request.Form ("domainrepay"&i&"_2")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay2-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_2"))&"元/成本"&realcostrepay2&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_3")) or CDbl(Request.Form ("domainrepay"&i&"_3"))<realcostrepay3) And Request.Form ("domainrepay"&i&"_3")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay3-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_3"))&"元/成本"&realcostrepay3&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_4")) or CDbl(Request.Form ("domainrepay"&i&"_4"))<realcostrepay4) And Request.Form ("domainrepay"&i&"_4")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay4-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_4"))&"元/成本"&realcostrepay4&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_5")) or CDbl(Request.Form ("domainrepay"&i&"_5"))<realcostrepay5) And Request.Form ("domainrepay"&i&"_5")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay5-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_5"))&"元/成本"&realcostrepay5&"元"
Response.End
end If
If (not IsNumeric(Request.Form ("domainrepay"&i&"_6")) or CDbl(Request.Form ("domainrepay"&i&"_6"))<realcostrepay6) And Request.Form ("domainrepay"&i&"_6")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay6-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_6"))&"元/成本"&realcostrepay6&"元"
Response.End
end If

If (not IsNumeric(Request.Form ("domainrepay"&i&"_7")) or CDbl(Request.Form ("domainrepay"&i&"_7"))<realcostrepay7) And Request.Form ("domainrepay"&i&"_7")>0 Then
Response.Write "存在不正常的金额！注意域名续费不能小于成本价-repay7-(域名编号:"&i&")。现"&CDbl(Request.Form ("domainrepay"&i&"_7"))&"元/成本"&realcostrepay7&"元"
Response.End
end if

If not IsNumeric(Request.Form ("domain"&i&"year2")) or CDbl(Request.Form ("domain"&i&"year2"))<realcostyear2 Then
Response.Write "域名类别:存在不正常的金额！注意不能小于成本价-repay-(2年)。"&CDbl(Request.Form ("domain"&i&"year2"))
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year3")) or CDbl(Request.Form ("domain"&i&"year3"))<realcostyear3 Then
Response.Write "域名类别:存在不正常的金额！注意不能小于成本价-repay-(3年)。"&CDbl(Request.Form ("domain"&i&"year3"))
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year4")) or CDbl(Request.Form ("domain"&i&"year4"))<realcostyear4 Then
Response.Write "域名类别:存在不正常的金额！注意不能小于成本价-repay-(4年)。"&CDbl(Request.Form ("domain"&i&"year4"))
Response.End
end if
If not IsNumeric(Request.Form ("domain"&i&"year5")) or CDbl(Request.Form ("domain"&i&"year5"))<realcostyear5 Then
Response.Write "域名类别:存在不正常的金额！注意不能小于成本价-repay-(5年)。"&CDbl(Request.Form ("domain"&i&"year5"))
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="域名产品"
ds("usermoney")=Request.Form ("domain"&i)

If Request.Form ("domainrepay"&i)>0 Then ds("usermoneyrepay")=Request.Form ("domainrepay"&i)
If Request.Form ("domainrepay"&i&"_2")>0 Then ds("usermoneyrepay2")=Request.Form ("domainrepay"&i&"_2")
If Request.Form ("domainrepay"&i&"_3")>0 Then ds("usermoneyrepay3")=Request.Form ("domainrepay"&i&"_3")
If Request.Form ("domainrepay"&i&"_4")>0 Then ds("usermoneyrepay4")=Request.Form ("domainrepay"&i&"_4")
If Request.Form ("domainrepay"&i&"_5")>0 Then ds("usermoneyrepay5")=Request.Form ("domainrepay"&i&"_5")
If Request.Form ("domainrepay"&i&"_6")>0 Then ds("usermoneyrepay6")=Request.Form ("domainrepay"&i&"_6")
If Request.Form ("domainrepay"&i&"_7")>0 Then ds("usermoneyrepay7")=Request.Form ("domainrepay"&i&"_7")

ds("year2")=Request.Form ("domain"&i&"year2")
ds("year3")=Request.Form ("domain"&i&"year3")
ds("year4")=Request.Form ("domain"&i&"year4")
ds("year5")=Request.Form ("domain"&i&"year5")
ds.Update
ds.Close
end if

End if'完成没有不同价


if Request.Form ("Sql"&i)<>"" then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='数据库产品' and username='"&Request.Form ("username")&"' and id="&i&""
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.eof then ds.AddNew

Set dsDlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_SqlProductlist where id="&i
		dsDlist.Open Sql,conn,1,1
Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='数据库产品' and username='"&session ("agentusername")&"' and id="&i
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
realcost=dsDlist("usermoney")*dsagnettype("pers")
else
realcost=dsagnpri("usermoney")
end if
dsagnpri.close
dsDlist.close
If not IsNumeric(Request.Form ("Sql"&i)) or CDbl(Request.Form ("Sql"&i))<realcost Then
Response.Write "数据库产品类别:存在不正常的金额！注意不能小于成本价。"&CDbl(Request.Form ("Sql"&i))&"元小于成本价,产品编号:"&i
Response.End
end if

ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="数据库产品"
ds("usermoney")=Request.Form ("Sql"&i)
ds.Update
ds.Close
end if


next
end if

if not ef then
	Set dsC = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_domain where id=0"
		dsC.Open Sql,conn,1,1
if dsC.eof then
	ef=True
	ec="请您先在站点管理,代理折扣中,设置代理使用的临时域名！"
end if
end if


if not ef then
dsagX("agenttype")="子代理"
dsagX("agentdegree")=session("agentdegree")+1
dsagX.update

'domain
	Set dsagentdomain = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_ALLdomain where domain='"&replace(Request.Form ("username")&"."&dsC ("domain"),"..",".")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
'		response.write sql
		dsagentdomain.Open Sql,conn,1,3
		if dsagentdomain.eof then
		dsagentdomain.addnew
		dsagentdomain("username")=Request.Form ("username")
		dsagentdomain("domain")=replace(Request.Form ("username")&"."&dsC ("domain"),"..",".")
		dsagentdomain("agent1")=session("agentusername")
		dsagentdomain("agent2")="n"
		dsagentdomain.update
		end if

set ds=nothing






	Set dsreg = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&request.Form ("username")&"'"
		dsreg.Open Sql,conn,1,3
if dsreg.eof then
Set dsagn = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&Request.Form ("username")&"'"
		dsagn.Open Sql,conn,1,1
If not dsagn.Eof Then
dsreg.AddNew
dsreg("username")=LCASE(trim(dsagn ("username")))
dsreg("password")=dsagn ("password")
dsreg("email")=dsagn ("email")
dsreg("truename")=dsagn ("truename")
dsreg("etruename")=dsagn ("etruename")
dsreg("coun")=dsagn ("coun")
dsreg("ecoun")=dsagn ("ecoun")
dsreg("prv")=dsagn ("prv")
dsreg("eprv")=dsagn ("eprv")
dsreg("city")=dsagn ("city")
dsreg("ecity")=dsagn ("ecity")
dsreg("address")=dsagn ("address")
dsreg("eaddress")=dsagn ("eaddress")
dsreg("postid")=dsagn ("postid")
dsreg("tel")=dsagn ("tel")
dsreg("qq")=dsagn ("qq")
'dsreg("perid")=dsagn ("perid")


dsreg("regtime")=NOW
dsreg("lastuse")=NOW
dsreg("regip")=Request.ServerVariables("REMOTE_ADDR")
If Request.ServerVariables("HTTP_FreeHostAPIIP")<>"" Then dsreg("regip")=Request.ServerVariables("HTTP_FreeHostAPIIP")

dsreg("usermoney")="0.00"

dsreg("hostphcount")=0
dsreg("emailphcount")=0
dsreg("domainphcount")=0
dsreg("haveupdate")="y"'3.0
dsreg("agent1")=session("agentusername")
dsreg("agent2")="n"
dsreg.update
end if
else'将用户金额转移到代理名下

if dsreg("usermoney")>0 then

olduser_money=dsreg("usermoney")
oldagn_money=dsagX("usermoney")

dsagX("usermoney")=dsagX("usermoney")+dsreg("usermoney")
dsreg("usermoney")=0
dsreg.update
dsagX.update

newuser_money=dsreg("usermoney")
newagn_money=dsagX("usermoney")

FreeHost_moneyNewlog conn,"y","n","y","n","n",isAgnHostSer,-(newuser_money-olduser_money),dsreg("username"),session("agentusername"),dsreg("username"),olduser_money,newuser_money,agnusername,agnStmoney,agnEndmoney,supusername,"开通代理自动扣除用户金额并转移给代理名下,扣用户所有金额","开通代理自动扣除用户金额并转移给代理名下,扣用户所有金额",whichProduct,pdid,pingzheng,type1,bank,haveget,havecheck

FreeHost_moneyNewlog conn,"n","y","y","n","y",isAgnHostSer,newagn_money-oldagn_money,dsreg("username"),session("agentusername"),norusername,norStmoney,norEndmoney,dsreg("username"),oldagn_money,newagn_money,supusername,"开通代理自动扣除用户金额并转移给代理名下增加给新开通的代理","开通代理自动扣除用户金额并转移给代理名下增加给新开通的代理",whichProduct,pdid,pingzheng,type1,bank,haveget,havecheck

out="<br><br>开通代理自动扣除用户金额并转移给代理名下:"&(newagn_money-oldagn_money)&"元"

end if
end if

If request.Form("pricetempsave")="yes" Then
dsagent("pricetemp"&request.Form("pricetemp"))=request.Form("username")
dsagent("pricetempname"&request.Form("pricetemp"))=request.Form("pricetempname")
dsagent.update
End if




conn.Close 
set conn=nothing
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>　修改成功
<%=htmlwrite("html6")%>
<br><br>修改成功！
<%If request.Form("pricetempsave")="yes" Then%>
保存为价格模板<%=request.Form("pricetemp")%>号(<%=request.Form("pricetempname")%>)成功!
<%End if%>
<%=htmlwrite("html7")%>
<%
end if
if ef then
Response.Redirect "e.asp?e="&ec
end if
 %>
