<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
'删除时间，默认是过期30天后删除。可以修改成您要的天数
todeldate=30
if not isnull(Application("todelday")) then todeldate=Application("todelday")

If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmsql")="" And session("canadmsqladd")="" And session("canadmsqlset")="" And session("canadmsqlrepay")="" And session("canadmsqldel")="" And session("canadmsqlpau")="" And session("canadmsqlch")="" And session("canadmsqlrenow")="" And session("canadmsqlupdate")="" Then
	ef=True
	ec="您没有此操作的权限。"
ElseIf Request("starttime")<>"" And Not IsDate(Request("starttime")) Then
	ef=True
	ec="时间格式无效startime"
ElseIf Request("endtime")<>"" And Not IsDate(Request("endtime")) Then
	ef=True
	ec="时间格式无效endtime"
ElseIf Request("starttime2")<>"" And Not IsDate(Request("starttime2")) Then
	ef=True
	ec="时间格式无效startime2"
ElseIf Request("endtime2")<>"" And Not IsDate(Request("endtime2")) Then
	ef=True
	ec="时间格式无效endtime2"
ElseIf Request("starttime1")<>"" And Not IsDate(Request("starttime1")) Then
	ef=True
	ec="时间格式无效startime1"
ElseIf Request("endtime1")<>"" And Not IsDate(Request("endtime1")) Then
	ef=True
	ec="时间格式无效endtime1"

ElseIf RegExpTest("[^A-Za-z0-9]",Request("username")) Then
	ef=True
	ec="用户名非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request("ftpname")) Then
	ef=True
	ec="ftp名非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request("sqlname")) Then
	ef=True
	ec="ftp名非法字符！"
ElseIf RegExpTest("[^A-Za-z0-9]",Request("ServerlistID")) Then
	ef=True
	ec="ServerlistID非法！"
end If

if not ef Then
If trim(replace(Request("hostname"),"http://",""))<>"" then
 
hostname=trim(replace(Request("hostname"),"http://",""))
if hostname<>"" then hostname=ComX.idntoac_7i24_com(cstr(hostname))
hostnamecheck=replace(hostname,".","")
hostnamecheck=replace(hostnamecheck,"xn--","")
If RegExpTest("[^A-Za-z0-9--]",hostnamecheck) Then
	ef=True
	ec="请输入合法的域名！"
end If
end if
end If

if not ef then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html8")%>
<%=htmlwrite("html9")%><TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="img/midtop4.gif">
  <TBODY>
    <TR>
      <TD width=53 align="left" background="img/midtop1.gif"><strong> 　 </strong><font color="#FFFFFF">─<strong>&gt;</strong></font> </TD>
      <TD width="113"><table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="90" align="center" valign="middle" background="img/r3.jpg" id="tableTop1" style="Cursor:hand"><a href="admsql.asp"><font color="#FFFFFF"><strong>数据库管理</strong></font></a></td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table></TD>
      <TD width="93">
	  
	  <table height="59"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="7" background="img/midtop.gif">&nbsp;</td>
            <td width="60" align="center" valign="middle" background="img/r3.jpg"  onClick="table1.style.display='none';table2.style.display='none';table3.style.display='';" id="tableTop2" style="Cursor:hand"><font color="#FFFFFF">到期处理<br>
            </font> </td>
            <td width="5" background="img/midtop2.gif">&nbsp;</td>
          </tr>
      </table>
	  
	  </TD>
      <TD width="113"><table height="59"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="7" background="img/midtop.gif">&nbsp;</td>
          <td width="80" align="center" valign="middle" background="img/r3.jpg" id="tableTop3" style="Cursor:hand"><a href="allsearch.asp"><font color="#FFFFFF">数据库搜索</font></a></td>
          <td width="5" background="img/midtop2.gif">&nbsp;</td>
        </tr>
      </table></TD>
      <TD width="83" align="left">&nbsp;</TD>
      <TD align="left">&nbsp;</TD>
      <TD width=23 align="right"><IMG height=59 
                  src="img/rtop4.jpg" 
                  width=19></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width=19 background="img/midlef.gif" id=rightid>&nbsp;</TD>
      <TD height="300" align="center" vAlign=top bgcolor="#FFFFFF">
<form action="admsql2.asp" method="post" name="form1">
<DIV class="tableborder" id="table1" <%if Request.QueryString ("op")<>"" then%> style="display:none"<%end if%>><table width="100%"  border="0" cellspacing="1">
        <tr >
          <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">开通新数据库</font></td>
        </tr>
        <tr bgcolor="#E4EAF2">
          <td width="9%" height="40" align="right" bgcolor="#E4EAF2">&nbsp;</td>
          <td width="91%" align="left">　用户名：
        <input name="username" type="text" id="username" size="10" maxlength="14">
数据库产品:
<%
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")

byhost=-2
if Request("ftpname")<>"" or trim(replace(Request("hostname"),"http://",""))<>"" then
Set dsph = Server.CreateObject("ADODB.Recordset")	
if Request("ftpname")<>""   then	Sql="Select * from FreeHost.FreeHost_Product_Host where Hosttype<>'子目录绑定' and  ftpname like '%"&Request("ftpname")&"%'"
if Request("hostname")<>"" then	Sql="Select * from FreeHost.FreeHost_Product_Host where Hosttype<>'子目录绑定' and  hostname like '%"&ComX.idntoac_7i24_com(cstr(hostname))&"%'"
			if Instr(1,sql, ";", 1)>0 or Instr(1,replace(sql,"xn--",""), "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end If
'Response.write sql
dsph.Open Sql,conn,1,1
if Not dsph.Eof Then
byhost=dsph("id")
Else
byhost=-1
End if
End If

	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_SqlProductlist order by id asc"
		ds.Open Sql,conn,1,1
If ds.Eof Then%>
数据库产品列表为空.
<%else%>
<select name="Sqltype" id="Sqltype">
  <%while not ds.Eof%>
  <option value="<%=ds("id")%>"><%=ds("Sqltype")%></option>
  <%
ds.movenext
wend%>
</select>
<%end if%>
　
<input name="Submit" type="submit" id="Submit" value="下一步">

		  </td>
        </tr>
      </table>
         </div>
</form>	
<form action="handSql1.asp" method="get" name="form1">
  <DIV class="tableborder"  id="table2" <%if Request.QueryString ("op")<>"" then%> style="display:none"<%end if%>>
    <table width="100%"  border="0" cellspacing="1">
      <tr >
        <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">暂停/恢复/修改/删除 数据库</font></td>
      </tr>
      <tr bgcolor="#E4EAF2">
        <td width="9%" height="40" align="right" bgcolor="#E4EAF2">&nbsp;</td>
        <td width="91%" align="left">　用户名：
          <input name="username" type="text" id="username" size="10" maxlength="14">
            　或数据库名：
<input name="sqlname" type="text" id="sqlname" size="10" maxlength="14">
            　或FTP用户名：
              <input name="ftpname" type="text" id="ftpname" size="10">            　
              或域名
              <input name="hostname" type="text" id="hostname">
        <input name="Submit" type="submit" id="Submit" value="下一步"></td>
      </tr>
    </table>
  </div>
</form>
<%if session("canadmsql")="y" then%>
<%if Request.QueryString ("op")<>"" then%><DIV class="tableborder" id="table3"  style="display:"><%else%><DIV class="tableborder" id="table3"  style="display:none"><%end if%>
<table width="100%"  border="0" cellspacing="1">
      <tr >
        <td height="24" colspan="2" align="center" background="img/tablebg.gif"><font color="#FFFFFF">数据库到期处理</font></td>
      </tr>
      <tr bgcolor="#E4EAF2">
        <td width="9%" height="130" align="right" bgcolor="#E4EAF2">&nbsp;</td>
        <td width="91%" align="left">
  　<a href="admsql.asp?op=pause"><strong><font color="#000000">到期应该暂停的数据库产品用户>>></font> </strong></a><br>
  　<a href="admsql.asp?op=del"><strong><font color="#000000">到期应该删除的数据库产品用户>>></font> </strong></a> <br>
  <br>
  　<a href="gemail.asp?type=Sql&da=30"><strong><font color="#000000">群发邮件给一个月后到期的用户>>></font> </strong></a> <br>
  　<a href="gemail.asp?type=Sql&da=7"><strong><font color="#000000">群发邮件给一周后到期的用户>>></font> </strong></a>
</td>
      </tr>
    </table>
</div><br>
<br>


<%
	Set dsph = Server.CreateObject("ADODB.Recordset")
SQL="Select * from FreeHost.FreeHost_Product_Sql where "
if Request.QueryString ("username")<>"" then Sql=Sql+"username= '"&trim(Request.QueryString ("username"))&"' and "
if Request.QueryString ("hostname")<>"" then Sql=Sql+"hostname like '%"&replace(Request.QueryString ("hostname"),"http://","")&"%' and "
'if Request.QueryString ("ftpname")<>"" then Sql=Sql+"ftpname like '%"&trim(Request.QueryString ("ftpname"))&"%' and "

If byhost>-2 then Sql=Sql+" byhost='"&byhost&"'"

if Request.QueryString ("sqlname")<>"" then Sql=Sql+"sqlname = '"&Request.QueryString ("sqlname")&"' and "

if Request.QueryString ("ServerlistID")<>"" then Sql=Sql+"ServerlistID = '"&trim(Request.QueryString ("ServerlistID"))&"' and "
'if Request.QueryString ("Sqltype")<>"" then Sql=Sql+"Sqltype = '"&trim(Request.QueryString ("Sqltype"))&"' and "

if Request.QueryString ("status")<>"" then
if Request.QueryString ("status")="过期暂停" then
Sql=Sql+"istest = 'n' and endtime < '"&now&"' and status = '暂停' and "
elseif Request.QueryString ("status")="过期未暂停" then
Sql=Sql+"istest = 'n' and endtime < '"&now&"' and status = '正常' and "
elseif Request.QueryString ("status")="试用过期未暂停" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and status = '正常' and "
elseif Request.QueryString ("status")="试用过期已暂停" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and status = '暂停' and "
elseif Request.QueryString ("status")="试用过期" then
Sql=Sql+"endtime < '"&now&"' and istest = 'y' and "
elseif Request.QueryString ("status")="试用" then
Sql=Sql+"endtime > '"&now&"' and istest = 'y' and "
'else
'Sql=Sql+"istest = 'n' and status = '"&trim(Request.QueryString ("status"))&"' and "
end if
end if

'if Request.QueryString ("beianstatus")<>"" and Request.QueryString ("beianstatus")<>"没有备案" then Sql=Sql+"beianstatus = '"&trim(Request.QueryString ("beianstatus"))&"' and "
if Request.QueryString ("beianstatus")="没有备案" then Sql=Sql+"beianstatus is null and "
if Request.QueryString ("starttime2") <>"" then  Sql=Sql+"starttime>'"&Request.QUERYSTRING ("starttime1")&"' and starttime<'"&Request.QUERYSTRING ("starttime2")&"' and "
if Request.QueryString ("endtime2") <>"" then  Sql=Sql+"endtime>'"&Request.QUERYSTRING ("endtime1")&"' and endtime<'"&Request.QUERYSTRING ("endtime2")&"' and "
if Request.QueryString ("starttime") <>"" then  Sql=Sql+"starttime>'"&Request.QUERYSTRING ("starttime")&"' and "
if Request.QueryString ("endtime") <>"" then  Sql=Sql+"endtime<'"&Request.QUERYSTRING ("endtime")&"' and "
if right(sql,5)=" and " then sql=left(sql,len(sql)-5)&" order by id desc"
if right(SQL,6)="where " then  SQL="Select * from FreeHost.FreeHost_Product_Sql order by id desc"

if Request.QueryString ("op") ="all" then Sql="Select * from FreeHost.FreeHost_Product_Sql order by id desc"
if Request.QueryString ("op") ="pause" then Sql="Select * from FreeHost.FreeHost_Product_Sql where endtime<'"&now&"' order by endtime desc"
if Request.QueryString ("op") ="del" then Sql="Select * from FreeHost.FreeHost_Product_Sql where endtime<'"&dateadd("d",-todeldate,now)&"' order by endtime desc"
if Request.QueryString ("op") ="willpause" then Sql="Select * from FreeHost.FreeHost_Product_Sql where endtime<'"&dateadd("d",30,now)&"' order by endtime desc "
if Request.QueryString ("space")<>"" then Sql="Select * from FreeHost.FreeHost_Product_Sql where (userspacelimtReal >userspacelimt or logspacelimtReal>logspacelimt) order by userspacelimtReal desc"


'Response.Write sql
'Response.End

	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsph.PageSize = 25
        dsph.Open Sql,conn,1,1
if not dsph.eof then
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 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
%>

<%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%>
<%if Request.QueryString ("op") ="" then%>
<a href="admsql.asp?starttime=<%=formatdatetime(now,2)%>"><font color="#000000">今天新开通</font></a> | <a href="admsql.asp?starttime=<%=formatdatetime(dateadd("d",-7,now),2)%>"><font color="#000000">一周新开通</font></a> | <a href="admsql.asp?endtime=<%=formatdatetime(dateadd("d",7,now),2)%>"><font color="#000000">一周到期</font></a> | <a href="admsql.asp?endtime=<%=formatdatetime(dateadd("d",30,now),2)%>"><font color="#000000">30天到期</font></a>
| <a href="admsql.asp?space=check"><font color="#000000">显示超出使用量的库</font></a>

<%end if%>
<DIV class="tableborder">
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr bgcolor="#C1BFBF" align="center">
    <td width="6%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">ID</font></td>
    <td background="img/tablebg.gif"><font color="#FFFFFF">产品类型</font></td>
    <td width="8%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户名</font></td>
    <td width="12%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">数据库名</font></td>
    <td width="12%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">IP 地址</font></td>
    <td width="12%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">开通/到期</font></td>
    <td width="12%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">大小检查</font></td>
    <td width="5%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">状态</font></td>
    <td width="5%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">操作</font></td>
    </tr>
<%
For N=1 To dsph.PageSize 
					If dsph.RecordCount=0 Then Exit For
%>
<%



	%>
  <tr align="center" bgcolor="#E4EAF2" onmouseover=this.bgColor='#cccccc'; onmouseout=this.bgColor='#E4EAF2';>
    <td><%=dsph("id")%></td>
    <td><%=dsph("Sqltype")%>      <%if dsph("byhost")<>"" then%>
<br>附属于产品 <a href="handhost1.asp?username=<%=dsph("username")%>&id=<%=dsph("byhost")%>"><font color="#FF0000"><%=dsph("byhost")%></font></a>
    <%end if%></td>
    <td width="8%" height="30"><a href="searchuser.asp?username=<%=dsph("username")%>"><%=dsph("username")%></a>
      <%if not isnull(dsph("kefu")) then%>
      <br>
      <a href="admkefu.asp?kefu=<%=dsph("kefu")%>">(<font color="#0000FF"><%=dsph("kefu")%>)</font></a>
      <%end if%></td>
    <td width="12%"><%=dsph("sqlname")%><br>
</td>
    <td width="12%"><%
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerSQLlist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
%><%=dsserver("ip")%><%dsserver.close%></td>
    <td width="12%"><%=formatdatetime(dsph("starttime"),1)%><br>
      <%=formatdatetime(dsph("endtime"),1)%></td>
    <td width="12%" title="数据库文件大小检查时间：<%=dsph("checktime")%>">库:<font color="<%if dsph("userspacelimtReal")>dsph("userspacelimt") then%>red<%end if%>"><%=dsph("userspacelimtReal")%></font>(<%=dsph("userspacelimt")%>)M<br>
日志:<font color="<%if dsph("logspacelimtReal")>dsph("logspacelimt") then%>red<%end if%>"><%=dsph("logspacelimtReal")%></font>(<%=dsph("logspacelimt")%>)M
</td>
    <td width="5%"><%if dsph("endtime")>NOW then%>
      <%if dsph("istest")="y" then%>
      <font color="#FF0000">试用</font><%else%>
      <%=dsph("status")%>
      <%end if%>
      <%else%>
      <font color="#FF0000">过期</font>
      <%if dsph("status")="暂停" then%>
      <br>
      <font color="#FF0000">暂停</font>
      <%end if%>
      <%end if%></td>
    <td><a href="handsql1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>"><font color="#000000">管理</font></a></td>
    </tr>
<%
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%></table>
</div>
<%if Request.QueryString ("op") ="pause" then%>
<br>
<a href="admsqlautodo.asp?op=pause"><font color="#FF0000">马上暂停尚未暂停的过期数据库>>></font></a>
<%end if%>
<%if Request.QueryString ("op") ="del" then%>
<br>
<a href="admsqlautodo.asp?op=del"><font color="#FF0000">马上删除上面页中的数据库>>></font></a>
<br>
<br>
<a href="admsqlautodo.asp?op=del&isall=yes"><font color="#FF0000">马上删除全部已到期的数据库>>></font></a>
<%end if%>
<%dsph.close
set dsph=nothing
else%>
<DIV class="tableborder"><br>
<br>
没有相关的记录。<br>
<br>
</div>
<%end if%><br>
	  <%else%>
	  您没有查看新开产品的权限.
	  <%end if%>

</TD>
      <TD width=18 background="img/midri.gif">&nbsp;</TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
    <TR>
      <TD width=30><IMG height=19 
                  src="img/rb1.jpg" 
                  width=30></TD>
      <TD 
                background=img/rb2.jpg>&nbsp;</TD>
      <TD width=30><IMG height=19 
                  src="img/rb3.jpg" 
                  width=30></TD>
    </TR>
  </TBODY>
</TABLE>
<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
