<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("username")="" Then
	ef=True
	ec="请您先登陆用户区，再续费，在主机面板中不能续费。也有可能是超时造成了出错。"
ElseIf Request("id")="" Then
	ef=True
	ec="请输入产品ID！"
ElseIf Instr(1, Request("id"), "'", 1)>0 then
	ef=True
	ec="非法产品ID！"
ElseIf not IsNumeric(Request("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
ElseIf Instr(1, session("username"), "'", 1)>0 then
	ef=True
	ec="非法用户名！"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where id='"&Request("id")&"' and username='"&session("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="不存在的云服务器ID！"
end if
end if

if not ef then
	Set dsHost = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_VPSProductlist where VPStype='"&dsph("VPStype")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsHost.Open Sql,conn,1,1
if dsHost.Eof then
	ef=True
	ec="产品不存在！"
end if
end If

if not ef then
if dsHost("cancloud")=true then'是弹性购买产品
Response.redirect "/user/cloudadmupdate1.asp?id="&Request("id")
end if
end If

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerVPSlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
end if
end if

if not ef then
%>
<!--#include virtual="/inc-freehost-function/template-vpsadm-top.asp"-->
　云服务器自助管理


<br>
<form action="selfvpsupdate1.asp" method="post" name="form1">
<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>
<%
	Set dsHostlist = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where canbyenduser='y'  and (onlyusebyagn is null or onlyusebyagn='"&session("agentname")&"') order by orderbyid desc"
if session("agentname")<>"n" then Sql="Select * from FreeHost.FreeHost_VPSProductlist where canbyagnenduser='y'  and (onlyusebyagn is null or onlyusebyagn='"&session("agentname")&"') order by orderbyid desc"
		dsHostlist.Open Sql,conn,1,1
If dsHostlist.Eof Then%>
产品列表为空.
<%else
while not dsHostlist.Eof

usermoney=dsHostlist("usermoney")
if session("agentname")<>"n" then
	Set dsendmoney = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Agent_user_price where prtype='云服务器产品' and username='"&session("agentname")&"' and id="&dsHostlist("id")&""
		dsendmoney.Open Sql,conn,1,1
if not dsendmoney.eof then
usermoney=dsendmoney("usermoney")
end if
dsendmoney.close
end if

if (dsHost("updatebytypeid")="y" and dsHostlist("typeid")=dsHost("typeid")) or isnull(dsHost("updatebytypeid")) or dsHost("updatebytypeid")="n" then
%>
  
    <TR>
      <TD height="35" vAlign=middle bgColor=#FFFFFF>　
        <input type="radio" name="Sqllistid" value="<%=dsHostlist("id")%>">
        <%=dsHostlist("id")%>.
        <%
	info=dsHostlist("info")
	Hosttype=dsHostlist("VPStype")
	Set newname_host = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_VPSProductlist_AGN where agent1='"&session("agentname")&"' and id='"&dsHostlist("id")&"'"
		newname_host.Open Sql,conn,1,1
if not newname_host.eof then
info=newname_host("info")
Hosttype=newname_host("VPStype")
newname_host.close
end if%>
      <%=Hosttype%> </TD>
      <TD height="35" align="center" vAlign=middle bgColor=#FFFFFF>价格：<%=usermoney%> 元 　<a href="/style/info/vpsmore.asp?id=<%=dsHostlist("id")%>" target="_blank"><font color="#000000">详细介绍</font></a><br>
        <font color=#0000FF><strong>
        <%if dsph("istest")="y" and dsph("VPStype")=dsHostlist("VPStype") then%>
        </strong>您现在正在试用此产品，请选择此项,马上升级到正式用户!</font><br>
　有效期限：
<%if dsHost("canmonth")="y" then%>
<input type="radio" name="year" value="<%=PAY_Month%>">
一个月
<%end if%>
<%if dsHost("canseason")="y" then%>
<input type="radio" name="year" value="<%=PAY_Season%>">
一季
<%end if%>
<%if dsHost("canhalfyear")="y" then%>
<input type="radio" name="year" value="<%=PAY_halfyear%>">
半年
<%end if%>
<input type="radio" name="year" value="<%=PAY_Nextyear%>" checked>
一年
<input type="radio" name="year" value="<%=PAY_2year%>">
两年
<input type="radio" name="year" value="<%=PAY_3year%>">
三年
<input type="radio" name="year" value="<%=PAY_4year%>">
四年
<input type="radio" name="year" value="<%=PAY_5year%>">
五年<br>
<%end if%></TD>
    </TR>
<%
end if
dsHostlist.movenext
wend
dsHostlist.close
set dsHostlist=nothing
end if%>	
    <TR>
      <TD height="30" colspan="2" align="center" vAlign=middle bgColor=#FFFFFF><input name="id" type="hidden" value="<%=Request("id")%>">
        <input type="submit" name="Submit" value="只计算升级费用">　
        <input type="submit" name="Submit" value="马上升级到此产品" onClick="if (confirm('升级时会强行停止您的VPS的运行,请您确认本次操作？')==false){return false;}"></TD>
    </TR>
</TABLE>
</form>

　<a href="selfvpsmodify.asp?id=<%=Request("id")%>"><font color="#000000">[返回上一页]</font></a>
<!--#include virtual="/inc-freehost-function/template-vpsadm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
