<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostEmail.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
server.ScriptTimeout =3600
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 ("type")="host" then totable="FreeHost.FreeHost_Product_Host"
if Request.QueryString ("type")="email" then totable="FreeHost.FreeHost_Product_Email"
if Request.QueryString ("type")="domain" then totable="FreeHost.FreeHost_Product_Domain"
if Request.QueryString ("type")="Sql" then totable="FreeHost.FreeHost_Product_Sql"
if Request.QueryString ("type")="other" then totable="FreeHost.FreeHost_Product_Other"

if Request.QueryString ("da") ="30" then Sql="Select * from "&totable&" where endtime<'"&dateadd("d",30,now)&"' and emailstatus is null and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') "
if Request.QueryString ("da") ="7" then Sql="Select * from "&totable&" where endtime<'"&dateadd("d",7,now)&"' and emailstatus='a' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') "
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="此类内容不存在！"
end if
end if

if not ef then
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
 　虚拟主机管理
 <%=htmlwrite("html6")%><br><br>成功发送<br><br>
<%
while not dsph.eof
if dsph("emailstatus")="b" then dsph("emailstatus")="c"
if dsph("emailstatus")="a" then dsph("emailstatus")="b"
if isnull(dsph("emailstatus")) then dsph("emailstatus")="a"
Set ds = Server.CreateObject("ADODB.Recordset")	
Sql="Select * from FreeHost.FreeHost_USER where username='"&dsph("username")&"' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') "
ds.Open Sql,conn,1,1
if not ds.eof then%>
用户名：<%=ds("username")%>　邮箱：<%=ds("email")%>　到期时间：<%=dsph("endtime")%><br>
<%Subject=Request.Form ("suject")&"　到期时间："&dsph("endtime")
body =Request.Form ("body")

ret=Send2Mail(conn,ds("username"),Subject,body)

end if
ds.close

dsph.update
dsph.movenext
wend
dsph.close
set dsph=nothing
%>
<%=htmlwrite("html7")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
