<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmidcset")="" Then
	ef=True
	ec="您没有此操作的权限。"
ElseIf Request.Form ("id")="" Then
	ef=True
	ec="请选择产品！"
ElseIf not IsDate(Request("starttime")) and Request("starttime")<>""  Then
	ef=True
	ec="请输入合法的开始日期！"
ElseIf not IsDate(Request("endtime")) and Request("endtime")<>""  Then
	ef=True
	ec="请输入合法的到期日期！"

ElseIf not IsNumeric(Request.Form ("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
ElseIf Request.Form ("usermoney")<>"" then
if Request.Form ("usermoney")<0 Then
	ef=True
	ec="扣除金额必须大于零"
end if
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsphIDC = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_IDC where id='"&Request.Form ("id")&"' and username='"&Request.Form("username")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsphIDC.Open Sql,conn,1,3
if dsphIDC.Eof then
	ef=True
	ec="不存在的IDC产品ID！"
end if
end if

if not ef then
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&dsphIDC("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
	Set dspdl = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCProductlist where IDCtype='"&dsphIDC ("IDCtype")&"'"
		dspdl.Open Sql,conn,1,1
If dspdl.Eof Then
	ef=True
	ec="不存在的IDC产品类型！"&dsphIDC ("IDCtype")
end if
end if

if not ef then
if Request.Form ("usermoney")<>"" then
cost=Clng(Request.Form ("usermoney"))
if cost>ds("usermoney") then
	ef=True
	ec="很抱歉,用户的余额不足B！"
end if
end if
end if



if not ef then

dsphIDC("userremindinfo")=Request.Form("userremindinfo")
dsphIDC("openinfo")=Request.Form("openinfo")
dsphIDC("admremindinfo")=Request.Form("admremindinfo")
dsphIDC("status")=Request.Form("status")
dsphIDC("ServerlistID")=Request.Form("ServerlistID")
dsphIDC("IDCtype")=Request.Form("IDCtype")
if dsphIDC("status")="正常" then
 dsphIDC("finishtime")=now
 dsphIDC("istest")="n"
end if 
if Request.Form("endtime")<>"" then dsphIDC("endtime")=Request.Form("endtime")
if Request.Form("starttime")<>"" then dsphIDC("starttime")=Request.Form("starttime")

if Request.Form("endtime")<>dsphIDC("endtime") then 
dsphIDC("emailstatus")=Null
dsphIDC("smsstatus")=Null
FreeHost_oplog session("admusername"),"信息","管理员修改IDC产品用户名"&dsphIDC("username")&"产品号:"&dsphIDC("id")&"新到期时间: "&Request.Form("endtime")
End if

conn.Execute "update FreeHost.FreeHost_IDCIP set PDID=0 where PDID="&dsphidc("id")

dsphidc("ip1")=Request.Form("ip1")
dsphidc("ip2")=Request.Form("ip2")
dsphidc("ip3")=Request.Form("ip3")
dsphidc("ip4")=Request.Form("ip4")

If Request.Form("ip1")="" Then dsphidc("ip1")=0
If Request.Form("ip2")="" Then dsphidc("ip2")=0
If Request.Form("ip3")="" Then dsphidc("ip3")=0
If Request.Form("ip4")="" Then dsphidc("ip4")=0
dsphidc("ip5")=0

for IPID=1 to 20000
If Request.Form("IPID"&IPID)<>"" and IsNumeric(Request.Form("IPID"&IPID)) Then conn.Execute "update FreeHost.FreeHost_IDCIP set PDID="&dsphidc("id")&" where ID="&Request.Form("IPID"&IPID)
next

dsphIDC.update

'log
if Request.Form("usermoney")<>"" then 
if Request.Form("usermoney")>0 then 

'开始扣费
olduser_money=ds("usermoney")
moneych=0
ds("usermoney") =ds("usermoney") -cost
moneych=-cost
ds.update

newuser_money=ds("usermoney")

pdtype=dsphIDC("IDCtype")
FreeHost_moneyNewlog conn,"y","n","y","n","n",isAgnHostSer,-moneych,dsphIDC ("username"),session("admusername"),dsphIDC ("username"),olduser_money,newuser_money,agnusername,agnStmoney,agnEndmoney,session("admusername"),"管理员修改IDC产品","管理员修改IDC产品","IDC产品",dsphIDC("id"),pingzheng,type1,bank,haveget,havecheck
end if
end if

dsphIDC.close
%>
<!--#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="113"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="90" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="admidc.asp"><font color="#FFFFFF"><strong>IDC管理</strong></font></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="93"><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"  onClick="table1.style.display='none';table2.style.display='none';table3.style.display='';" id="tableTop2" style="Cursor:hand"><font color="#FFFFFF"><a href="admidcrepair.asp"><font color="#FFFFFF"><strong>维护记录</strong></font></a><br>
            </font> </td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="113"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="80" align="center" valign="middle" background="img/r3.jpg" id="tableTop3" style="Cursor:hand"><a href="allsearch.asp"></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></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>
        <table width="65%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
	
	<br>
<br>


	<DIV class="tableborder">	<br>
	<br>
	<br>
保存成功.
  <br>
  <br>
  <br>	
  </div>

	
	
	</td>
  </tr>
</table>

      </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%>
