<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canagnper")="" Then
	ef=True
	ec="您没有此操作的权限。"
elseIf Request.Form ("username")="" or RegExpTest("[^A-Za-z0-9]",Request.Form ("username")) or Instr(1, Request.Form ("username"), "'", 1)>0 or Instr(1, Request.Form ("username"), "-", 1)>0 or Instr(1, Request.Form ("username"), " ", 1)>0 or Instr(1, Request.Form ("username"), "&", 1)>0 or Instr(1, Request.Form ("username"), ".", 1)>0 or Instr(1, Request.Form ("username"), "_", 1)>0 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_Agent where username='"&Request.Form ("username")&"'"
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
	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
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
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
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
ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="CDN产品"
ds("usermoney")=Request.Form ("CDN"&i)
ds.Update
ds.Close
end if

if Request.Form ("domain"&i)<>"" Or trim(Request.Form("domain"&i&"API1"))<>"" 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
ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="域名产品"

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

if Application("domaincansetM")=true Then
For api=1 To 7
ds("usermoneyAPI"&api)=trim(Request.Form("domain"&ds("id")&"API"&api))
'ds("usermoneyagnAPI"&api)=trim(Request.Form("usermoneyagn"&ds("id")&"API"&api))
ds("year2API"&api)=trim(Request.Form("domain"&ds("id")&"year2API"&api))
'ds("year2agnAPI"&api)=trim(Request.Form("usermoneyagn"&ds("id")&"year2API"&api))
ds("year3API"&api)=trim(Request.Form("domain"&ds("id")&"year3API"&api))
'ds("year3agnAPI"&api)=trim(Request.Form("usermoneyagn"&ds("id")&"year3API"&api))
ds("year4API"&api)=trim(Request.Form("domain"&ds("id")&"year4API"&api))
'ds("year4agnAPI"&api)=trim(Request.Form("usermoneyagn"&ds("id")&"year4API"&api))
ds("year5API"&api)=trim(Request.Form("domain"&ds("id")&"year5API"&api))
'ds("year5agnAPI"&api)=trim(Request.Form("usermoneyagn"&ds("id")&"year5API"&api))
Next
Else

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

End if

ds.Update
ds.Close
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
ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="数据库产品"
ds("usermoney")=Request.Form ("Sql"&i)
ds.Update
ds.Close
end if


if Request.Form ("Other"&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
ds("id")=i
ds("username")=Request.Form ("username")
ds("prtype")="其他产品"
ds("usermoney")=Request.Form ("Other"&i)
ds.Update
ds.Close
end if



next

set ds=nothing
conn.Close 
set conn=nothing
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html8")%>
<%=htmlwrite("html9")%><TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="img/midtop4.gif">
  <TBODY>
    <TR>
      <TD width=53 align="left" background="img/midtop1.gif"><strong> 　 </strong><font color="#FFFFFF">─<strong>&gt;</strong></font> </TD>
      <TD width="83"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="60" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="agentpercent.asp"><font color="#FFFFFF">代理折扣</font></a><a href="logininfo.asp"></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="83">&nbsp;</TD>
      <TD width="83">&nbsp;</TD>
      <TD width="83" align="left">&nbsp;</TD>
      <TD align="left">&nbsp;</TD>
      <TD width=23 align="right"><IMG height=59 
                  src="img/rtop4.jpg" 
                  width=19></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width=19 background="img/midlef.gif" id=rightid>&nbsp;</TD>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF"><br>
<br>
设置成功。</TD>
      <TD width=18 background="img/midri.gif">&nbsp;</TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
      <TD width=30><IMG height=19 
                  src="img/rb1.jpg" 
                  width=30></TD>
      <TD 
                background=img/rb2.jpg>&nbsp;</TD>
      <TD width=30><IMG height=19 
                  src="img/rb3.jpg" 
                  width=30></TD>
    </TR>
  </TBODY>
</TABLE>
<%=htmlwrite("html10")%>
<%
end if
if ef then
Response.Redirect "e.asp?e="&ec
end if



Function RegExpTest(patrn, strng)
  Dim regEx
  Set regEx = New RegExp
  regEx.Pattern = patrn
  regEx.IgnoreCase = False
  RegExpTest = regEx.Test(strng)
End Function %>
