<%@ 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_Host 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 dsHostpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_HostProductlist where Hosttype='"&dsph("Hosttype")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsHostpdlist.Open Sql,conn,1,1
if dsHostpdlist.Eof then
	ef=True
	ec="产品不存在！"
else
typeid=dsHostpdlist("typeid")
end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Serverlist 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-hostadm-top.asp"-->
　虚拟主机自助管理


<br>
<form action="selfhostupdate1.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_HostProductlist 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_HostProductlist 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

If dsHostlist("cantwodb")=true Then
canselectdb=false
else
canselectdb=true
end if

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 (dsHostpdlist("updatebytypeid")="y" and dsHostlist("typeid")=dsHostpdlist("typeid")) or isnull(dsHostpdlist("updatebytypeid")) or dsHostpdlist("updatebytypeid")="n" then
%>
  
    <TR>
      <TD height="35" vAlign=middle bgColor=#FFFFFF>　
        <input type="radio" name="Hostlistid" value="<%=dsHostlist("id")%>">
        <%=dsHostlist("id")%>.
        <%
	info=dsHostlist("info")
	Hosttype=dsHostlist("Hosttype")
	Set newname_host = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_HostProductlist_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("Hosttype")
newname_host.close
end if%>
      <%=Hosttype%> </TD>
<%
SERVER_NAME=Request.ServerVariables("SERVER_NAME")
RefSERVER_NAME=LCase(Left(Replace(Request.ServerVariables("HTTP_REFERER"),"http://",""),Len(SERVER_NAME)))
If RefSERVER_NAME<>SERVER_NAME And RefSERVER_NAME<>"" Then SERVER_NAME=RefSERVER_NAME
%>
      <TD height="35" align="center" vAlign=middle bgColor=#FFFFFF>价格：<%=usermoney%> 元 　<a href="http://<%=SERVER_NAME%>/style/info/hostmore.asp?id=<%=dsHostlist("id")%>" target="_blank"><font color="#000000">详细介绍</font></a><br>
<%
If canselectdb then
	Set dsSqlpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_SqlProductlist where Hosttype='"&dsHostlist("Hosttype")&"' and isbyhost='y'"
	dsSqlpdlist.Open Sql,conn,1,1
if not dsSqlpdlist.Eof Then
havesql=true%>
　　附送：
<select name="dsSqlpdlistID<%=dsHostlist("id")%>"><%end if%>
<%while not dsSqlpdlist.Eof
	Set dsSqlserver = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Serversqllist where id='"&dsSqlpdlist ("ServerlistID")&"'"
		dsSqlserver.Open Sql,conn,1,1
while not dsSqlserver.Eof%>
<option value="<%=dsSqlpdlist("id")%>"><%=dsSqlserver("softtype")%> [大小<%=dsSqlpdlist("userspacelimt")%>M]</option>
<%dsSqlserver.movenext
wend
dsSqlserver.close
dsSqlpdlist.movenext
wend%>
<%If havesql=True then%></select> 注意选择后不能更改<%End if%>
<%dsSqlpdlist.close

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="马上升级到此产品">	
		</TD>
    </TR>
</TABLE>
</form>
<%if dsHostpdlist("canupdatespace")="y" then%>
<!--
<form action="updatespace.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>

  
    <TR>
      <TD width="46%" height="35" align="center" vAlign=middle bgColor=#FFFFFF>价格：每10M <%=dsHostpdlist("updatespacemoney")%>元　
        </TD>
      <TD width="54%" height="35" align="center" vAlign=middle bgColor=#FFFFFF>
        <input name="space" type="text" id="space" value="10" size="4" maxlength="5">0M
</TD>
    </TR>

    <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="马上升级到此产品">	
		</TD>
    </TR>
</TABLE>
</form>-->
<%end if%>
　<a href="selfhostmodify.asp?id=<%=Request("id")%>"><font color="#000000">[返回上一页]</font></a>
<!--#include virtual="/inc-freehost-function/template-hostadm-end.asp"-->
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
