<%@ 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 ("id"))  Then
	ef=True
	ec="ID应该是数字！"
end If

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")

username=session("username")
agentname=session("agentname")
AgnRunasUser=session("AgnRunasUser")
If session("agentusername")<>"" Then
agentname=session("agentusername")
username=session("agentusername")
AgnRunasUser=True
End If


if AgnRunasUser=True then 
	Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent where username='"&agentname&"'"
		dsagent.Open Sql,conn,1,1
if Not dsagent.eof then
Set dsagnettype = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_Agent_pers where agenttype='"&dsagent("agenttype")&"'" 
		dsagnettype.Open Sql,conn,1,1
if Not dsagnettype.eof Then
canshowagnpric=True
Else
canshowagnpric=false
End if
end If
dsagent.close
end If

	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&username&"'"
		ds.Open Sql,conn,1,3
if ds.eof then
	ef=True
	ec="用户不存在!"
end if

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

if not ef then
If dsph("status")<>"正常" 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="产品不存在！"
Else
'读取月付
PAY_Month=dsNetCNpdlist("PAY_Month")
PAY_Season=dsNetCNpdlist("PAY_Season")
PAY_halfyear=dsNetCNpdlist("PAY_halfyear")
PAY_Nextyear=dsNetCNpdlist("PAY_Nextyear")
PAY_2year=dsNetCNpdlist("PAY_2year")
PAY_3year=dsNetCNpdlist("PAY_3year")
PAY_4year=dsNetCNpdlist("PAY_4year")
PAY_5year=dsNetCNpdlist("PAY_5year")
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>
<form action="hostnetcnadmrepay2.asp" method="post" name="autoopen">
<TABLE 
            width="100%" border=1 align=center cellPadding=0 cellSpacing=0 borderColorLight=#cccccc borderColorDark=#fbfbfb>
  <TBODY>
    <TR align="center">
      <TD height="35" colspan="2" vAlign=middle bgColor=#494949>&nbsp; <font color="#FFFFFF">延长使用期限：</font></TD>
      </TR>
    <TR>
      <TD height="17" align="center" vAlign=middle bgColor=#FFFFFF>开通时间：<%=formatdatetime(dsph("starttime"),1)%></TD>
      <TD align="center" vAlign=middle bgColor=#FFFFFF>到期时间：<%=formatdatetime(dsph("endtime"),1)%></TD>
    </TR>
    <TR>
      <TD height="18" colspan="2" align="center" vAlign=middle bgColor=#FFFFFF>延长：
        <%if dsNetCNpdlist("canmonth")="y" then%>
        <input type="radio" name="year" value="<%=PAY_Month%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_Month%>*document.autoopen.moneynowstd.value);">
一个月
<%end if%>
<%if dsNetCNpdlist("canseason")="y" then%>
<input type="radio" name="year" value="<%=PAY_Season%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_Season%>*document.autoopen.moneynowstd.value);">
一季
<%end if%>
<%if dsNetCNpdlist("canhalfyear")="y" then%>
<input type="radio" name="year" value="<%=PAY_halfyear%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_halfyear%>*document.autoopen.moneynowstd.value);">
半年
<%end if%>
<input type="radio" name="year" value="<%=PAY_Nextyear%>" checked onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_Nextyear%>*document.autoopen.moneynowstd.value);" >
一年
<input type="radio" name="year" value="<%=PAY_2year%>"  onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_2year%>*document.autoopen.moneynowstd.value);" >
两年
<input type="radio" name="year" value="<%=PAY_3year%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_3year%>*document.autoopen.moneynowstd.value);" >
三年
<input type="radio" name="year" value="<%=PAY_4year%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_4year%>*document.autoopen.moneynowstd.value);" >
四年
<input type="radio" name="year" value="<%=PAY_5year%>" onClick="document.autoopen.moneynow.value =Math.round(<%=PAY_5year%>*document.autoopen.moneynowstd.value);">
五年 </TD>
    </TR>
    <TR>
      <TD height="33" colspan="2" align="center" vAlign=middle bgColor=#FFFFFF>        <%
usermoney=dsNetCNpdlist("usermoney")
if agentname<>"n" then
	Set dsendmoney = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_user_price where prtype='IDC产品' and username='"&agentname&"' and id="&dsNetCNpdlist("id")&""
		dsendmoney.Open Sql,conn,1,1
if not dsendmoney.eof then
usermoney=dsendmoney("usermoney")
end if
dsendmoney.close
end if
%><%if isnull(dsph("repaymoney")) then%>

<%if canshowagnpric then%>　　<font color=red>(代理成本价格
<%
	Set dsagnpri = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_price where prtype='万网主机产品' and username='"&agentname&"' and id="&dsNetCNpdlist("id")&""
		dsagnpri.Open Sql,conn,1,1
if dsagnpri.eof then
usermoney=dsNetCNpdlist("price"&dsagnettype("id"))'得到产品定义中的此级别的代理价
'if isreplay then myrealcost=RsDlist("usermoneyagnrepay")'续费
else
usermoney=dsagnpri("usermoney")'如果手工定义过此代理的价格就提取此价格
'if isreplay then myrealcost=dsagnpri("usermoneyrepay")'续费
end if
dsagnpri.close
%>)</font><%End if%> 

<input name="moneynowstd" type="hidden" value="<%=usermoney%>">
<input name="moneynow" type="text" value="<%=usermoney*PAY_Nextyear%>" size="7" readonly="true" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" >
 元<%else%>(单独设置的价格)　<%=dsph("repaymoney")%> 元/年
<%end if%></TD>
    </TR>
    <TR>
      <TD height="28" colspan="2" align="center" vAlign=middle bgColor=#FFFFFF><input name="id" type="hidden" value="<%=Request("id")%>">
        <input type="submit" name="Submit" value="马上续期"></TD>
    </TR>
  </TBODY>
</TABLE>
</form>

　<a href="idcadm.asp?id=<%=Request("id")%>"><font color="#000000">[返回上一页]</font></a>


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