<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("username")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
If session("HOSTAUID")<>"" Then ec="主机面板中不能操作用户区的内容，请您先登陆用户区。"
If session("EmailAUID")<>"" Then ec="邮箱面板中不能操作用户区的内容，请您先登陆用户区。"
If session("SQLAUID")<>"" Then ec="数据库面板中不能操作用户区的内容，请您先登陆用户区。"
If session("VPSAUID")<>"" Then ec="VPS面板中不能操作用户区的内容，请您先登陆用户区。"
ElseIf Request("vpsname")<>"" and RegExpTest("[^A-Za-z0-9]",Request("vpsname")) Then
	ef=True
	ec="VPS户名中有非法字符！"
end If

If Request.QueryString("ip")<>"" and not IsNumeric(Replace(Request.QueryString("ip"),".",""))  Then
	ef=True
	ec="IP不对！"	
End if

If not IsNumeric(Request("id"))  Then
	ef=True
	ec="产品ID应该是数字！"
End if

if Request("id")<>"" then
vpsid=Request("id")
end if

if not ef Then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
If Request.QueryString("ip")<>""  Then
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where ip='"&Request.QueryString ("ip")&"' and vpsid>0"
	dsph.Open Sql,conn,1,1
if dsph.Eof Then
	ef=True
	ec="IP不存在！"
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where AgnUpIP like '%"&Request.QueryString ("ip")&"%'"
	dsph.Open Sql,conn,1,1
if dsph.Eof Then
	ef=True
	ec="IP不存在！"
Else
	ef=False
vpsid=dsph("id")
dsph.close
'Response.redirect "handvps1agn.asp?vpsname="&dsph("vpsname")
End if
Else
vpsid=dsph("vpsid")
dsph.close
End If
End If
End If

if not ef then
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
云服务器管理
<%=htmlwrite("html3")%>

<br>
<br>
<%
Set dsphVPS = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session("username")&"' order by endtime desc"
if Request("vpsname")<>"" then Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session("username")&"' and  vpsname='"&Request("vpsname")&"'"
if Request.QueryString ("ip") <>"" then Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session("username")&"' and id='"&vpsid&"'"
if Request ("id") <>"" then Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&session("username")&"' and id='"&vpsid&"'"
'response.write sql
			if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsphVPS.PageSize = 25
	dsphVPS.Open Sql,conn,1,1
if dsphVPS.Eof then%>
没有开通的云服务器产品.	
<%else%>
<%
if Request.ServerVariables("QUERY_STRING")<>"" then
ask=Split(Request.ServerVariables("QUERY_STRING"), chr(38)&"pn")
else
ask=Split("freehost=1", "")
ask(0)="freehost=lsoft"
end if
	pn=1
if Request.QueryString ("pn")<>"" then pn=Request.QueryString ("pn")
If dsphVPS.RecordCount <> 0 Then dsphVPS.AbsolutePage = CLng(pn)  
    if clng(pn)<=10 then
    begini=1
      if dsphVPS.PageCount<=10 then
       endini=dsphVPS.PageCount 
       else
       endini=10
      end if
    end if
%>
<%if clng(pn)<=10 then%>最新 <%for i=begini to endini
    if clng(pn)=i then%><font color=red>[<%=i%>]</font><%else%><a href="?<%=ask(0)%>&pn=<%=i%>"><font color="#000000">[<%=i%>]</font></a><%end if%>　<%next%> 
        <%else%>　<a href="?<%=ask(0)%>&pn=1"><font color="#000000">最新[1]--[10]</font></a>　　现在是第<font color=red>[<%=pn%>]</font>页 
        　共<%=dsphVPS.PageCount%>页　<%end if%><%If Clng(pn)>1 Then%><a href="?<%=ask(0)%>&pn=<%=pn-1%>">上一页</a><%End If%>|<%If Clng(pn)<dsphVPS.PageCount Then%><a href="?<%=ask(0)%>&pn=<%=pn+1%>"><font color="#000000">下一页</font></a>
        <%End If%>
<form action="vpsadmip2.asp" method="post" name="formip">		
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#CCCCCC">
  <tr bgcolor="#EEEEEE" align="center">
    <td>编号</td>
    <td>产品类型</td>
    <td>云服务器名</td>
    <td>IP 地址</td>

    <td>操作</td>
  </tr>
<%
For N=1 To dsphVPS.PageSize 
					If dsphVPS.RecordCount=0 Then Exit For
%>
<%
	VPStype=dsphVPS("VPStype")
	Set ori_VPS_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where VPStype='"&dsphVPS("VPStype")&"'"
		ori_VPS_name.Open Sql,conn,1,1
		if not ori_VPS_name.eof then
Set newname_VPS = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_VPSProductlist_AGN where agent1='"&session("agentname")&"' and id='"&ori_VPS_name("id")&"'"
		newname_VPS.Open Sql,conn,1,1
if not newname_VPS.eof then
VPStype=newname_VPS("VPStype")
end if
		end if

	%>
  <tr align="center" bgcolor="#FFFFFF">
    <td><%=dsphVPS("id")%><input type="hidden" name="id" value="<%=dsphVPS("id")%>"></td>
    <td><%=VPStype%> </td>
    <td><%=dsphVPS("vpsname")%></td>
    <td><%
	if dsphVPS("isagentpd")=true then%>
<%if not isnull(dsphVPS("AgnUpIP")) then%><%=replace(dsphVPS("AgnUpIP"),"|","<br>")%><%end if%>
	<%
	else
	Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_IP where VPSID="&dsphVPS("id")
'		response.write sql
		dsX.Open Sql,conn,1,1
while not dsX.eof
%>
<input name="ipid" type="checkbox" value="<%=dsX("id")%>" checked><%=dsX("IP")%> <br>
<%
if dsX("portstart")>0 then

Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerVPSlist where id='"&dsphVPS ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
isONEip=dsserver("isONEip")	

if isONEip=true then
	Set dsPORTserver = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_ServerPORTlist where id='"&dsserver("useportserver")&"'"
		dsPORTserver.Open Sql,conn,1,1%>
<%=dsPORTserver("IP")%>(公网)<br>
<%end if	

end if
dsX.movenext
wend
end if
%>
<%
if not isnull(dsphVPS("ADSLName")) then
%>拨号资源(手工录入)：<%=dsphVPS("ADSLName")%>/<%=dsphVPS("ADSLpass")%><br>
<%else
	Set dsADSL = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_VPS_ADSL where VPSID="&dsphVPS("id")
		dsADSL.Open Sql,conn,1,1
while not dsADSL.eof%>
   拨号资源：<%=dsADSL("ADSLName")%>/<%=dsADSL("ADSLpass")%><br>
<%		
dsADSL.movenext
wend
end if%></td>

    <td bgcolor="#FFFFFF">      <br>
      <input type="submit" name="Submit" value="删除不选中的IP">      <br>
      <br>
      在删除前请您先与客服人员联系好调整财务,<br>
      IP生效需要强行重启云服务器，为了保护您的重要数据，<br>
      建议您先将云服务器关机。<br>
      <br></td>
  </tr>

 <%if ori_VPS_name("cancloud")=true then%> 
  
  
    <tr align="center" bgcolor="#FFFFFF">
      <td>&nbsp;</td>
    <td height="30" colspan="9"><a href="vpsadm2.asp?id=<%=dsphVPS("id")%>&go=a"></a>弹性云：内存<%=dsphVPS("MaXRam")%>M CPU个数：<%=dsphVPS("cpunum")%>
硬盘：<%=dsphVPS("maxspace")%>G 月流量上限：
<%if dsphVPS("CDNMaxMb")=0 then%>
不限流量
<%else%><%=dsphVPS("CDNMaxMb")%>MB
<%end if%> 
带宽上限：
<%if dsphVPS("MaxMbps8")=0 then%>
不限
<%else%><%=dsphVPS("MaxMbps8")%>Mbps
<%end if%></td>
  </tr>
 <%end if%> 
  
<%
If clng(pn)=dsphVPS.PageCount Then
I = dsphVPS.RecordCount - (dsphVPS.PageCount-1) * dsphVPS.PageSize
If N=I Then Exit For
End If
dsphVPS.movenext
Next%>
</table>
<%dsphVPS.close
set dsphVPS=nothing
end if
%>
</form>
<br><br>
<br>
<form action="vpsadmip.asp" method="get" name="form1">
  <table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
    <tr bgcolor="">
      <td>查找云服务器：</td>
    </tr>
  </table>
  <table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="9%" height="30" rowspan="2" bgcolor="#FFFFFF"><p>　云服务器名：
          <input name="vpsname" type="text" id="vpsname">
          　或IP：
          <input name="IP" type="text" value="" size="15" maxlength="30">
          <input type="submit" name="Submit" value="查找">
      </p></td>
    </tr>
  </table>
</form>
<%=htmlwrite("html4")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
