<!--#include file="../include/config.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
   <%
sub checkmanage(str)
Set mrs = conn.Execute("select * from manage where username='"&request.cookies("buyok")("admin")&"'")
if not (mrs.bof and mrs.eof) then
manage=mrs("manage")
if instr(manage,str)<=0 then
response.write "<script language='javascript'>"
response.write "alert('警告：您没有此项操作的权限！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
else
session("buyok_admin_login")=0
end if
else 
response.write "<script language='javascript'>"
response.write "alert('没有登陆，不能执行此操作！');"
response.write "location.href='quit.asp';"
response.write "</script>"
response.end
end if
set mrs=nothing
end sub
%>
<%call checkmanage("05")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../images/css.css" type=text/css rel=stylesheet>
<LINK href="../list/newhead.css" type=text/css rel=stylesheet>
<script language=javascript>
<!--
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked; 
}
}
-->
</script>
</head>
<BODY bgcolor="#D9EAFC">
		  <table height="5"><tr><td></td></tr></table>
<TABLE cellSpacing=0 cellPadding=0 width=95% border=0 style="BORDER-RIGHT: #b1bfee 1px solid; BORDER-TOP: #b1bfee 1px solid; BORDER-LEFT: #b1bfee 1px solid; BORDER-BOTTOM: #b1bfee 1px solid" 
>
  <TBODY>
    <TR> 
      <TD width="90%" bgColor=#f4f5fd><font color="#000000">　<B><font color="#FF0000">邮件群发</font></B></font></TD>
      <TD bgColor=#f4f5fd height=30></TD>
    </TR>
  </TBODY>
</TABLE>		  <table height="5"><tr><td></td></tr></table>

<%
action=request("action")
if action="sendmail" then
call sendmail()
else
%>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#b1bfee" width="95%">
<form action=user3.asp method=post name=usermail>
<tr bgcolor="#FFFFFF">
<td colspan=3 class=td height=18>会员邮件列表</td></tr>

<%  
pages = 20
sql="select * from buser where UserNum is not null "
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then 
response.write "<tr bgcolor=#FFFFFF><td colspan=3 align=center height=50>没有注册会员，未生成邮件列表</td></tr>"
response.end 
rs.close
set rs=nothing
end if

totaluser=RS.RecordCount
rs.pageSize = pages
allPages = rs.pageCount
page = Request("page")
If not isNumeric(page) then page=1
if isEmpty(page) or clng(page) < 1 then
page = 1
elseif clng(page) >= allPages then
page = allPages 
end if
rs.AbsolutePage = page

response.write "<tr bgcolor=#FFFFFF><td align=center width='5%'>选</td><td width=30% align=center>会员ID</td><td align=center>会员Email</td></tr>"

Do While Not rs.eof and pages>0 
response.write "<tr bgcolor=#FFFFFF><td height=25><input type='checkbox' value='"&rs("UserMail")&"' name=usermail></td><td>"&rs("userid")&"</td><td>"&rs("usermail")&"</td></tr>"

pages = pages - 1
rs.movenext
if rs.eof then exit do
loop
%>

<tr bgcolor="#FFFFFF"><td colspan=3>
<input type='checkbox' name=chkall onclick='CheckAll(this.form)'>全选 
<input type=hidden name=action value=sendmail>
<input type=submit value="群发邮件">
</td></tr>
</form>

<table>
<%
call listPages()
end if

sub listPages() 
'分页
'if allpages<=1 then exit sub
response.write "<br>总记录数<font color=red>"&totaluser&"</font> &nbsp; 每页<font color=red>20</font>&nbsp; "
if page = 1 then
response.write "<font color=darkgray>首页 前页</font>"
else
response.write "<a href=user3.asp?keywords="&keywords&"&page=1>首页</a> <a href=user3.asp?keywords="&keywords&"&page="&page-1&">前页</a>"
end if
if page = allpages then
response.write "<font color=darkgray> 下页 末页</font>"
else
response.write " <a href=user3.asp?keywords="&keywords&"&page="&page+1&">下页</a> <a href=user3.asp?keywords="&keywords&"&page="&allpages&">末页</a>"
end if
end sub


sub sendmail()

usermail=request("usermail")
if usermail="" or isnull(usermail) then
response.write "<script language='javascript'>"
response.write "alert('出错了，您什么也没有选择！');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
usermail=replace(usermail,", ",";")
response.redirect "sendmail.asp?"&usermail
end sub
%>
</body>
</html>
<%
conn.close
set conn=nothing
%>