<%@ Language=VBScript %>

<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmidc")="" And session("canadmidcadd")="" And session("canadmidcset")="" 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("ServerlistID")) Then
	ef=True
	ec="ServerlistID非法！"
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="admidc.asp"><font color="#FFFFFF"><strong>IDC管理</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"   id="tableTop2" style="Cursor:hand"><font color="#FFFFFF"><a href="admidcrepair.asp"><font color="#FFFFFF"><strong>维护记录</strong></font></a><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"></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="admidc2.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">开通IDC业务</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">
IDC产品:
<%
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_idcProductlist order by orderbyid desc"
		ds.Open Sql,conn,1,1
If ds.Eof Then%>
产品列表为空.
<%else%>
<select name="idctype" id="idctype">
  <%while not ds.Eof%>
  <option value="<%=ds("idctype")%>"><%=ds("idctype")%></option>
  <%
ds.movenext
wend%>
</select>
<%end if%>
所在的机柜：
<%Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCJG order by id asc"
		dsX.Open Sql,conn,1,1
If dsX.Eof Then%>
机柜列表为空.
<%else%>
<select name="ServerlistID" id="ServerlistID">
  <option value="0" checked>产品默认的机柜</option>
  <%while not dsX.Eof%>
  <option value="<%=dsX("id")%>"><%=dsX("id")%>.<%=dsX("jgname")%>[<%=dsX("jfname")%>]</option>
  <br>
  <%
dsX.movenext
wend%>
</select>
<%end if%><br>
　
<input name="Submit" type="submit" id="Submit" value="下一步"></td>
        </tr>
      </table>
         </div>
</form>	
<form action="handidc1.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">暂停/恢复/修改/删除 IDC产品</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">
          或IP
          <input name="ip" type="text" id="ip" value="" size="14" maxlength="30">或到期时间
          <input name="endtime" type="text" id="endtime" value="" size="14" maxlength="30">
          <input name="Submit" type="submit" id="Submit" value="下一步"></td>
      </tr>
    </table>
  </div>
</form>
<%if session("canadmidc")="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="admidc.asp?op=pause"><strong><font color="#000000">到期应该暂停的邮箱产品用户>>></font> </strong></a><br>
　<a href="admidc.asp?op=del"><strong><font color="#000000">到期应该删除的邮箱产品用户>>></font> </strong></a> <br>
  <br>
　<a href="gidc.asp?type=idc&da=30"><strong><font color="#000000">群发邮件给一个月后到期的用户>>></font> </strong></a> <br>
　<a href="gidc.asp?type=idc&da=7"><strong><font color="#000000">群发邮件给一周后到期的用户>>></font> </strong></a> <br>
  <br>
　<a href="admidclistFunction.asp?op=all" target="_blank"><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_idc 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 Request.QueryString ("ServerlistID")<>"" then Sql=Sql+"ServerlistID = '"&trim(Request.QueryString ("ServerlistID"))&"' and "
'if Request.QueryString ("idctype")<>"" then Sql=Sql+"idctype = '"&trim(Request.QueryString ("idctype"))&"' 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<'"&dateadd("d",1,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_idc order by id desc"

if Request.QueryString ("op") ="all" then Sql="Select * from FreeHost.FreeHost_Product_idc order by id desc"
if Request.QueryString ("op") ="pause" then Sql="Select * from FreeHost.FreeHost_Product_idc where endtime<'"&now&"' order by endtime desc"
if Request.QueryString ("op") ="del" then Sql="Select * from FreeHost.FreeHost_Product_idc where endtime<'"&dateadd("d",-30,now)&"' order by endtime desc"
if Request.QueryString ("op") ="willpause" then Sql="Select * from FreeHost.FreeHost_Product_idc where endtime<'"&dateadd("d",30,now)&"' order by endtime 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="admidc.asp?starttime=<%=formatdatetime(now,2)%>"><font color="#000000">今天新开通</font></a> | <a href="admidc.asp?starttime=<%=formatdatetime(dateadd("d",-7,now),2)%>"><font color="#000000">一周新开通</font></a> | <a href="admidc.asp?endtime=<%=formatdatetime(dateadd("d",7,now),2)%>"><font color="#000000">一周到期</font></a> | <a href="admidc.asp?endtime=<%=formatdatetime(dateadd("d",3,now),2)%>"><font color="#000000">3天到期</font></a> | <a href="admidc.asp?endtime=<%=formatdatetime(dateadd("d",30,now),2)%>"><font color="#000000">30天到期</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="7%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">用户名</font></td>
    <td width="11%" height="24" background="img/tablebg.gif"><font color="#FFFFFF">机　柜</font></td>
    <td width="11%" 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("idctype")%>
      <%
	IDCtype=dsph("IDCtype")
	Set ori_IDC_name = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCProductlist where IDCtype='"&dsph("IDCtype")&"'"
		ori_IDC_name.Open Sql,conn,1,1
		if not ori_IDC_name.eof then	  
	  if ori_IDC_name("istg")=true then%>
      [托管]
      <%else%>
      [租用]
      <%end if
	  end if
	  ori_IDC_name.close
	  %>      
</td>
    <td width="7%" 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="11%"><%
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_IDCJG where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,conn,1,1
%>
      <%=dsserver("jgname")%>
      <%dsserver.close%></td>
    <td width="11%">
<%
	Set dsX = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_IDCIP where PDID="&dsph("id")
		dsX.Open Sql,conn,1,1
If dsX.Eof Then%>
IP尚未分配
<%else
while not dsX.eof
%>
<%=dsX("IP")%>
<br>
<%
dsX.movenext
wend
end if%>

</td>
    <td width="12%"><%=formatdatetime(dsph("starttime"),1)%></td>
    <td width="12%"><%=formatdatetime(dsph("endtime"),1)%></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="handidc1.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="admidcautodo.asp?op=pause"><font color="#FF0000">马上暂停尚未暂停的过期邮箱的用户>>></font></a>
<%end if%>
<%if Request.QueryString ("op") ="del" then%>
<br>
<a href="admidcautodo.asp?op=del"><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%>
