<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("agentusername")="" 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")	
if Request.QueryString ("op") ="all" then Sql="Select * from FreeHost.FreeHost_Product_Sql where  (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by id desc"
if Request.QueryString ("op") ="pause" then Sql="Select * from FreeHost.FreeHost_Product_Sql where endtime<'"&now&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by endtime desc"
if Request.QueryString ("op") ="del" then Sql="Select * from FreeHost.FreeHost_Product_Sql where endtime<'"&dateadd("d",-30,now)&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by endtime desc"
	dsph.PageSize = 25
	dsph.Open Sql,conn,1,1
if dsph.Eof then
	ef=True
	ec="此类数据库不存在！"
end if
end if

if not ef then
ask=Split(Request.ServerVariables("QUERY_STRING"), chr(38)&"pn")
	pn=1
if Request.QueryString ("pn")<>"" then pn=Request.QueryString ("pn")
If dsph.RecordCount <> 0 Then dsph.AbsolutePage = CLng(pn)  
    if clng(pn)<=10 then
    begini=1
      if dsph.PageCount<=10 then
       endini=dsph.PageCount 
       else
       endini=10
      end if
    end if
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
 　数据库管理
 <%=htmlwrite("html6")%>
<%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>页 
        　共<%=dsph.PageCount%>页　<%end if%><%If Clng(pn)>1 Then%><a href="?<%=ask(0)%>&pn=<%=pn-1%>">上一页</a><%End If%>|<%If Clng(pn)<dsph.PageCount Then%><a href="?<%=ask(0)%>&pn=<%=pn+1%>">下一页</a><%End If%>
<%
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
<table width="100%"  border="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td width="4%" rowspan="2" align="center" bgcolor="#F5F5F5">
<%=dsph("id")%>
    <td width="75%" height="30" bgcolor="#CCCCCC"> 　产品类型：<%=dsph("Sqltype")%> 用户名:<%=dsph("username")%> 　 
	  <%if dsph("byhost")<>"" then%>
	  附属于产品 <a href="hostadm2.asp?id=<%=dsph("id")%>&go=a"><font color="#FF0000"><%=dsph("byhost")%></font></a>
    <%end if%></td>
    <td width="14%" rowspan="2" align="center" bgcolor="#F5F5F5">
      <strong><font color="#000000">
      <%if dsph("endtime")>NOW then%>
      <%if dsph("istest")="y" then%>
      目前处于试用期!
      <%else%>
	  <%=dsph("status")%></font>
	  <font color="#000000">
	  <%end if%>  
      <%else%>
	  已过期！</font>
      <font color="#000000">
      <%if dsph("status")="暂停" then%>
      <br>
      并且已暂停!
      <%end if%>
      </font></strong><font color="#000000"> 	  <%end if%>
 	  </a>
	  </font></td>
    <td width="7%" rowspan="2" align="center" bgcolor="#F5F5F5"><a href="handSql1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>"><font color="#000000">管理</font></a>
	</td>
  </tr>
  <tr>
    <td height="42" bgcolor="#F5F5F5"><font color="#000000"> 　开通时间:<%=dsph("starttime")%>　到期时间:<%=dsph("endtime")%> </font></td>
  </tr>
</table>
<%
If clng(pn)=dsph.PageCount Then
I = dsph.RecordCount - (dsph.PageCount-1) * dsph.PageSize
If N=I Then Exit For
End If
dsph.movenext
Next

dsph.close
set dsph=nothing
%>
<%if Request.QueryString ("op") ="pause" then%>
<a href="admSqlautodo.asp?op=pause"><font color="#FF0000">马上暂停尚未暂停的过期数据库产品的用户>>></font></a>
<%end if%>
<%if Request.QueryString ("op") ="del" then%>
<a href="admSqlautodo.asp?op=del"><font color="#FF0000">马上删除上面的用户>>></font></a>
<%end if%>
<%=htmlwrite("html7")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
