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

If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canadmemailset")="" 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_Email order by id desc"
if Request.QueryString ("op") ="pause" then Sql="Select * from FreeHost.FreeHost_Product_Email where endtime<'"&now&"' and status<>'暂停' order by endtime desc"
if Request.QueryString ("op") ="del" then Sql="Select * from FreeHost.FreeHost_Product_Email where endtime<'"&dateadd("d",-todeldate,now)&"' order by endtime desc"
	dsph.PageSize = 25
if Request.QueryString ("isall") ="yes" Then 	dsph.PageSize = 100000
	dsph.Open Sql,conn,1,3
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("html8")%> 邮箱管理
<%=htmlwrite("html9")%>
<%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%>">[<%=i%>]</a><%end if%>　<%next%> 
        <%else%>　<a href="?<%=ask(0)%>&pn=1">最新[1]--[10]</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%>
<%
while not dsph.Eof%>
<table width="100%"  border="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td width="3%" rowspan="2" align="center" bgcolor="#FFCC66"><%=dsph("id")%>
    <td width="76%" bgcolor="#FFCC66">产品类型：<%=dsph("Emailtype")%> 用户名:<%=dsph("username")%> 
    <td width="14%" rowspan="2" align="center" bgcolor="#FFCC66"><%if dsph("endtime")>NOW then%>
        <%if dsph("istest")="y" then%>
        <strong><font color=#000099>目前处于试用期!</font></strong>
        <%else%>
        <font color="#FFFFFF"><%=dsph("status")%></font>
        <%end if%>
        <%else%>
        <font color="#FFFFFF"><strong>已过期！</strong></font>
        <%if dsph("status")="暂停" then%>
        <br>
        <font color="#FFFFFF">并且已暂停!</font>
        <%end if%>
        <%end if%>
    </td>
    <td width="7%" rowspan="2" align="center" bgcolor="#FFCC66"><a href="handemail1.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>" target="_blank">管理</a>
        <%if Request.QueryString ("op") ="del" then%>
        <br>
        <br>
        <a href="handhosthanddel.asp?username=<%=dsph("username")%>&id=<%=dsph("id")%>">删除</a><br>
        <br>
        <%end if%>
    </td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC">开通时间:<%=dsph("starttime")%>　到期时间:<%=dsph("endtime")%> </td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td bgcolor="#F7F7F7">
      <font color="#FF0000">
      <%
Set connA=Server.CreateObject("ADODB.Connection")
	connA.Open Application("FreeHostDBlink")

	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerEmaillist where id='"&dsph ("ServerlistID")&"'"
	dsserver.Open Sql,connA,1,1
if dsserver.Eof then%>
此邮箱的服务器在数据库中不存在！
<%else

if Request.QueryString ("op") ="pause" then
op=1

Set dspdallemail = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_ALLEmail where PdEID='"&dsph ("id")&"' order by emailname"
		dspdallemail.Open Sql,connA,1,3
while not dspdallemail.eof
Response.Write PauseEmail(dsph ("ServerlistID"),dspdallemail("emailname"),op)
dspdallemail("status")="暂停"
dspdallemail.movenext
wend
dspdallemail.close

dsph("status")="暂停"
dsph.update
end if

if Request.QueryString ("op") ="del" then
Set dspdallemail = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_Product_ALLEmail where PdEID='"&dsph ("id")&"' order by emailname"
		dspdallemail.Open Sql,connA,1,3
if not dspdallemail.Eof then
email=trim(dspdallemail("emailname"))
emailarry=split(email,"@")
name1=emailarry(0)
olddomain=lcase(trim(emailarry(1)))
ret=DelAdmEmail(dsph ("ServerlistID"),olddomain)
end if

while not dspdallemail.eof
Response.Write ret
dspdallemail.delete
dspdallemail.movenext
wend
dspdallemail.close

Set conn3=Server.CreateObject("ADODB.Connection")
	conn3.Open Application("FreeHostDBlink")
FreeHost_clientlog conn3,dsph ("username"),session("admusername"),"超级管理员操作","邮箱产品",dsph ("id"),"删除","","",ret
dsph.delete
dsph.update
end if
%>
      </font>
<%end if%>
</td>
  </tr>
</table>
<%
dsph.movenext
wend
dsph.close
set dsph=nothing
%>
<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
