<!--#include virtual="/inc/conn.asp"-->
<!--#include virtual="/inc/chkuser.asp"-->
<!--#include virtual="/inc/mailto.asp"--> 
<style type="text/css">
<!--
body,td,th {
	font-size: 13px;
}
--> 
</style>
<title>群发系统</title>
<%
call lognamecode()
call logquanxian("f3",1)

toact=SafeRequestformks("toact")



if toact="tobzdel" then

	list1=SafeRequestformks("list1")
	if list1="" then call PopErr("未找到此项目")

	delid=split(list1,",")
	
	For dianka=0 To Ubound(delid) 
	
		set rsadmin=server.CreateObject("adodb.recordset")
		sqladmin="select ayjibie,aynameid,aybiaozhu from ayname where aynameid="&trim(delid(dianka))&"" 
		rsadmin.open sqladmin,conn,1,3
		if cint(rsadmin("ayjibie"))<>9 then
		rsadmin("aybiaozhu")=7
		rsadmin.update
		end if
		rsadmin.close	
	
	next
	%>
	<script language="javascript">
    alert('操作成功。');
    window.close();
    </script>
    <%
			
end if


if SafeRequestformks("toact")="tomail" then


	
	
biaoti=trim(SafeRequestformks("biaoti"))
biaoti2=trim(SafeRequestformks("biaoti2"))
zhuti=trim(SafeRequestformks("zhuti"))
geshi=trim(SafeRequestformks("geshi"))
fangshi1=trim(SafeRequestformks("fangshi1"))
fangshi2=trim(SafeRequestformks("fangshi2"))
list=trim(SafeRequestformks("list1"))

	
	
if fangshi1="" then fangshi1=0
if fangshi2="" then fangshi2=0

if fangshi1=0 and fangshi2=0 then call PopErr2("请选择发送方式","adminmailqf.asp")

if fangshi2=1 then
if biaoti2="" then call PopErr2("请填写手机短信标题","adminmailqf.asp")
end if
	
if fangshi1=1 then
if biaoti="" or zhuti="" then call PopErr2("请填写相关信息","adminmailqf.asp")
end if

	response.Cookies("biaoti")=biaoti
	response.Cookies("biaoti2")=biaoti2
	response.Cookies("zhuti")=zhuti
	response.Cookies("geshi")=geshi
	response.Cookies("fangshi1")=fangshi1
	response.Cookies("fangshi2")=fangshi2


	delid=split(list,",")
	sum=Ubound(delid)

	For dianka=0 To Ubound(delid) 
	
	rs.open "select aynameid,aymail,aytel from ayname where aynameid="&trim(delid(dianka))&"",conn,1,1
	if not(rs.bof and rs.eof) then
	
		if request.Cookies("fangshi1")=1 then
			if trim(rs("aymail"))<>"" then
			conn.Execute("Insert Into mailto(mlei,mto,mti,mcon) values('0','"&trim(rs("aymail"))&"','"&trim(request.Cookies("biaoti"))&"','"&trim(request.Cookies("zhuti"))&"')")
			end if
		end if
			
		'if request.Cookies("fangshi2")=1 then
		'	if trim(rs("aytel"))<>"" then
		'	conn.Execute("Insert Into mailto(mlei,mfs,mto,mcon) values('0','1','"&trim(rs("aytel"))&"','"&trim(request.Cookies("biaoti2"))&"')")	
		'	end if
		'end if

	end if
	rs.close
	
	next

end if



%>

<script language="javascript">
alert('正在发信。');
window.close();
</script>