<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.Form ("Hosttype")=""  or Instr(Request.Form ("Hosttype"), "'")>1  Then
	ef=True
	ec="产品名没填！"
ElseIf Request.Form ("productid")=""  or Instr(Request.Form ("productid"), "'")>1  Then
	ef=True
	ec="productid产品名没填！"
ElseIf Request.Form ("usermoney")="" Then
	ef=True
	ec="金额没填！"
ElseIf not IsNumeric(Request.Form ("usermoney"))  Then
	ef=True
	ec="金额应该是数字！"
ElseIf Request.Form ("PAY_Month")="" Then
	ef=True
	ec="月付没填！"
ElseIf not IsNumeric(Request.Form ("PAY_Month"))  Then
	ef=True
	ec="月付应该是数字！"
ElseIf Request.Form ("PAY_Season")="" Then
	ef=True
	ec="季付没填！"
ElseIf not IsNumeric(Request.Form ("PAY_Season"))  Then
	ef=True
	ec="季付应该是数字！"
ElseIf Request.Form ("PAY_halfyear")="" Then
	ef=True
	ec="半年付没填！"
ElseIf not IsNumeric(Request.Form ("PAY_halfyear"))  Then
	ef=True
	ec="半年付应该是数字！"
ElseIf Request.Form ("PAY_Nextyear")="" Then
	ef=True
	ec="续费没填！"
ElseIf not IsNumeric(Request.Form ("PAY_Nextyear"))  Then
	ef=True
	ec="续费应该是数字！"
ElseIf Request.Form ("PAY_2year")="" Then
	ef=True
	ec="二年付费率没填！"
ElseIf not IsNumeric(Request.Form ("PAY_2year"))  Then
	ef=True
	ec="二年付费率应该是数字！"
ElseIf Request.Form ("PAY_3year")="" Then
	ef=True
	ec="三年付费率没填！"
ElseIf not IsNumeric(Request.Form ("PAY_3year"))  Then
	ef=True
	ec="三年付费率应该是数字！"
ElseIf Request.Form ("PAY_4year")="" Then
	ef=True
	ec="四年付费率没填！"
ElseIf not IsNumeric(Request.Form ("PAY_4year"))  Then
	ef=True
	ec="四年付费率应该是数字！"
ElseIf Request.Form ("PAY_5year")="" Then
	ef=True
	ec="五年付费率没填！"
ElseIf not IsNumeric(Request.Form ("PAY_5year"))  Then
	ef=True
	ec="五年付费率应该是数字！"
elseIf session("cansetpro")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_NETCNProductlist where productid='"&Request.Form ("productid")&"'"
		ds.Open Sql,conn,1,3
if not ds.Eof and Request.Form ("modify")<>"修改" and Request.Form ("delit")<>"删除" then
	ef=True
	ec="已存在同名的产品！"
end if

if Request.Form ("modify")="修改" and ds.Eof then
	ef=True
	ec="没找到要修改的产品！"
end if

'if Request.Form ("delit")="删除" and not ds.Eof then
'Set dsph = Server.CreateObject("ADODB.Recordset")	
'Sql="Select * from FreeHost.FreeHost_Product_NETCN where Hosttype='"&Request.Form ("Hosttype")&"'"
'	dsph.Open Sql,conn,1,1
'if not dsph.Eof then
'	ef=True
'	ec="此产品已有开通的用户，只能修改，不能删除！"
'end if
'dsph.close
'set dsph=nothing
'end if

if not ef then

'if Request.Form ("modify")<>"修改" then ds.addnew
ds("Hosttype")=Request.Form("Hosttype")
ds("usermoney")=Request.Form("usermoney")
ds("ServerlistID")=Request.Form("ServerlistID")

ds("info")=Request.Form("info")
ds("infomore")=Request.Form("infomore")
ds("remindinfo")=Request.Form("remindinfo")
if Request.Form("canmonth")="y" then
ds("canmonth")="y"
else
ds("canmonth")="n"
end if

if Request.Form("canseason")="y" then
ds("canseason")="y"
else
ds("canseason")="n"
end if

if Request.Form("canhalfyear")="y" then
ds("canhalfyear")="y"
else
ds("canhalfyear")="n"
end if

if Request.Form("canbyenduser")="y" then
ds("canbyenduser")="y"
else
ds("canbyenduser")="n"
end if
if Request.Form("canbyagnenduser")="y" then
ds("canbyagnenduser")="y"
else
ds("canbyagnenduser")="n"
end if
if Request.Form("canbyagn")="y" then
ds("canbyagn")="y"
else
ds("canbyagn")="n"
end if

if  IsNumeric(Request.Form("orderbyid")) then
ds("orderbyid")=Request.Form("orderbyid")
else
ds("orderbyid")=0
end if

if  IsNumeric(Request.Form("typeid")) then
ds("typeid")=Request.Form("typeid")
else
ds("typeid")=0
end if


if  IsNumeric(Request.Form("typeid")) then
ds("typeid")=Request.Form("typeid")
else
ds("typeid")=0
end if

if Request.Form("allowupdate")="y" then
ds("allowupdate")="y"
else
ds("allowupdate")="n"
end if

if Request.Form("allowupdatetoother")="y" then
ds("allowupdatetoother")="y"
else
ds("allowupdatetoother")="n"
end if

if Request.Form("updatebytypeid")="y" then
ds("updatebytypeid")="y"
else
ds("updatebytypeid")="n"
end If

if  IsNumeric(Request.Form("ServerlistID2")) then ds("ServerlistID2")=Request.Form("ServerlistID2")
if  IsNumeric(Request.Form("ServerlistID3")) then ds("ServerlistID3")=Request.Form("ServerlistID3")
if  IsNumeric(Request.Form("ServerlistID4")) then ds("ServerlistID4")=Request.Form("ServerlistID4")
if  IsNumeric(Request.Form("ServerlistID5")) then ds("ServerlistID5")=Request.Form("ServerlistID5")

ds("PAY_Month")=Request.Form("PAY_Month")
ds("PAY_Season")=Request.Form("PAY_Season")
ds("PAY_halfyear")=Request.Form("PAY_halfyear")
ds("PAY_Nextyear")=Request.Form("PAY_Nextyear")
ds("PAY_2year")=Request.Form("PAY_2year")
ds("PAY_3year")=Request.Form("PAY_3year")
ds("PAY_4year")=Request.Form("PAY_4year")
ds("PAY_5year")=Request.Form("PAY_5year")

If Trim(Request.Form("onlyusebyagn"))<>"" then
ds("onlyusebyagn")=Request.Form("onlyusebyagn")
Else
ds("onlyusebyagn")=null
End if


	Set dsagentpers = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_pers"
		dsagentpers.Open Sql,conn,1,1
while not dsagentpers.eof
If Not IsNumeric(Request.Form("pers"&dsagentpers("id"))) Then 
response.write "请您输入所有的价格定义。"
response.end
End if
ds("price"&dsagentpers("id"))=Request.Form("pers"&dsagentpers("id"))
dsagentpers.movenext
Wend
dsagentpers.close

ds.Update

ds.Close
set ds=nothing
conn.Close 
set conn=nothing
Response.Redirect "product-NETCN.asp"
end if

end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>