<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
server.ScriptTimeout =240
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmvps")="" And session("canadmvpsadd")="" And session("canadmvpsset")="" And session("canadmvpsch")="" And session("canadmvpsmidsub")="" And session("canadmvpsmiddomain")="" And session("canadmvpsmidcpu")="" And session("canadmvpsmidrepay")="" And session("canadmvpsdel")="" And session("canadmvpsoth")="" And session("canadmvpsaddtest")="" Then
	ef=True
	ec="您没有此操作的权限。"
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")
	Set dsphVPS = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where id='"&Request("id")&"'"
	dsphVPS.Open Sql,conn,1,3
if dsphVPS.Eof then
	ef=True
	ec="不存在的产品ID！"
end if
end If


if not ef then
	Set dspdl = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where VPStype='"&dsphVPS ("VPStype")&"'"
		dspdl.Open Sql,conn,1,1
If dspdl.Eof Then
	ef=True
	ec="不存在的云服务器产品类型！"
end if
end if

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerVPSlist where id='"&dsphVPS ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="服务器不存在！"
else
URL=dsserver("site")
FreeHostsharekey=dsserver("FreeHostsharekey")
username=dsphVPS("username")
vpsname=dsphVPS("vpsname")
'homedir=dsserver("homedir")
todir=dsphVPS("vhdpath")
MAXspace=dsphVPS("MAXspace")
end if
end if

if not ef then
%>
<html>
<head>
<style type="text/css">
<!--
p9,body,td,p,br {  font-size: 9pt}
.p11{  font-size: 10.5pt}
.pend{  font-size: 9px}
A:visited {	COLOR:#003399; TEXT-DECORATION: none}
A:hover { COLOR: red; TEXT-DECORATION: underline}
A:link { COLOR: #003399;TEXT-DECORATION: none}
.lxa{ line-height: 16px; }
.lxb{ line-height: 20px; }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>vps</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
          <br>
          <br>
 <TABLE 
            width="600" border=1 align=center cellPadding=0 cellSpacing=0 borderColorLight=#cccccc borderColorDark=#fbfbfb>
   <TBODY>
     <TR>
       <TD width="23%" height="35" align="center" vAlign=middle bgColor=#F3F3F3>&nbsp;<font color="#000000">产品类型：</font></TD>
       <TD width="77%" height="35" bgColor=#ffffff><%
	vpstype=dspdl("vpstype")
	info=dspdl("info")
	Set ori_VPS_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_VPSProductlist where vpstype='"&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='"&dsphVPS("agent1")&"' and id='"&ori_VPS_name("id")&"'"
		newname_VPS.Open Sql,conn,1,1
if not newname_VPS.eof then
vpstype=newname_VPS("vpstype")
info=newname_VPS("info")
end if
		end if

	%>　　<%=vpstype%> </TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>在数据库中的状态：</TD>
       <TD height="35" bgColor=#ffffff>　　
         <%if dsphVPS("endtime")>NOW then%>
         <%if dsphVPS("istest")="y" then%>
         <font color="#FF0000">试用</font>
         <%else%>
         <%=dsphVPS("status")%>
         <%end if%>
         <%else%>
         <font color="#FF0000">过期</font>
         <%if dsphVPS("status")="暂停" then%>
         <br>
         <font color="#FF0000">暂停</font>
         <%end if%>
         <%end if%></TD>
     </TR>
     <TR>
       <TD width="23%" height="35" align="center" vAlign=middle bgColor=#F3F3F3>开通时间：</TD>
       <TD height="35" bgColor=#ffffff>　　<%=formatdatetime(dsphVPS("starttime"),1)%></TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>到期时间：</TD>
       <TD height="35" bgColor=#ffffff>　　<%=formatdatetime(dsphVPS("endtime"),1)%></TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>云服务器名：</TD>
       <TD height="35" bgColor=#ffffff>　　<%=dsphVPS("vpsname")%></TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>在服务器上的状态：</TD>
       <TD height="35" bgColor=#ffffff>
<%
On Error Resume next
varcon="show "&vpsname&" "&Replace(todir,".vhd","-2.vhd")&"  1 2 3 4 7 100 101 102 103 104 105 106 107 108 109"
temp=VPSOP(URL,FreeHostsharekey,varcon,0)

'response.write temp

canpic=false

arrystr=Split(temp,vbcrlf)

For i=0 To UBound(arrystr)
'命令成功执行。显示信息:
'GUID: B6B70FFD-D4D3-4D16-AC9B-481D88BEC41D
'云服务器名: hjkhjh
'创建时间: 20081126043220.149505-000
'说明: 用户名:test,建立于:2008/11/26 12:32:20,建立时资源分配:CPU个数:1个,CPU上限:20%内存上限:555空间上限:15G,VHD位置:c:\vps\hjkhjh.vhd
'CPU数量: 1
'缩略图: 获得成功
str="缩略图: "
If Left(arrystr(i),Len(str))=str Then canpic=true

'启动状态: 2
'当前CPU使用量: 0
str="当前CPU使用量: "
If Left(arrystr(i),Len(str))=str Then ProcessorLoad=right(arrystr(i),Len(arrystr(i))-Len(str))
str="启动状态: "
If Left(arrystr(i),Len(str))=str Then EnabledState=right(arrystr(i),Len(arrystr(i))-Len(str))
'ProcessorLoadHistory: System.UInt16[]
'内存: 555
str="内存: "
If Left(arrystr(i),Len(str))=str Then maxram=right(arrystr(i),Len(arrystr(i))-Len(str))

str="GUID: "
If Left(arrystr(i),Len(str))=str Then GUID=right(arrystr(i),Len(arrystr(i))-Len(str))

'Heartbeat: 2
'运行时间: 16577649
str="运行时间: "
If Left(arrystr(i),Len(str))=str Then Uptime=right(arrystr(i),Len(arrystr(i))-Len(str))/1000
'VPS中的操作系统: Microsoft Windows Server 2003
'健康状态: 5

'FileSize:3723539968
'MaxInternalSize:16106127360
'Type:3
'InUse:TRUE
'InSavedState:TRUE

str="FileSize:"
If Left(arrystr(i),Len(str))=str Then FileSize=right(arrystr(i),Len(arrystr(i))-Len(str))/1024/1024

str="MaxInternalSize:"
If Left(arrystr(i),Len(str))=str Then MaxInternalSize=right(arrystr(i),Len(arrystr(i))-Len(str))/1024/1024/1024

Next

If canpic then
httpurl=Url&"/log/"&vpsname&".jpg"
Set http=Server.CreateObject("MSXML2.ServerXMLHTTP")
http.Open "GET",httpurl,False
'response.write httpurl
http.send
session("picdata")=http.responsebody
End if
%>	   
	   　　<%=EnabledState%>　</TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>　　硬件情况：</TD>
       <TD height="35" bgColor=#ffffff>　　当前CPU使用量：<%=ProcessorLoad%>%　总内存：<%=maxram%>M</TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>　　虚拟硬盘情况：</TD>
       <TD height="35" bgColor=#ffffff>　　第一虚拟硬盘固定为10G大小,第二虚拟硬盘大小：<%=MaxInternalSize%>G 第二虚拟硬盘真实占用：<%=FileSize%>M </TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>已运行时间:</TD>
       <TD height="35" bgColor=#ffffff>　　 <%=Fix(Uptime/60)%> 分钟</TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>实时截图：</TD>
       <TD height="35" bgColor=#ffffff>　　
           <%If canpic then%>
           <img src="/vpsadm/vpsimg.asp">
           <%else%>
           无
           <%End if%></TD>
     </TR>
     <TR>
       <TD height="35" align="center" vAlign=middle bgColor=#F3F3F3>服务器上的操作日志：</TD>
       <TD height="35" bgColor=#ffffff>　　
           <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
               <td><%


httpurl=Url&"/log/"&vpsname&".txt"
Set http=Server.CreateObject("MSXML2.ServerXMLHTTP")
http.Open "GET",httpurl,False
http.send

returnstr = Replace(bytes2BSTR(http.responsebody),vbcrlf,"<br>")

If http.status=200 then
response.write returnstr
else%>
没有日志内容
<%End if
%></td>
             </tr>
           </table>
       </TD>
     </TR>

   </TBODY>
</TABLE>
 <br>
<br>
<br>
<%
end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>