<!--#include file="conn.asp"-->
<!--#include file="../include/sendmail.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
else
if request.cookies("timesshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
end if
end if
if FormatSQL(SafeRequest("action",0))="save" then
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权设置会员广播！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select book from [User] order by userid",conn,1,3
do while not rs.eof
rs("book")=trim(request.Form("book"))
rs.update
rs.movenext
loop
rs.close
set rs=nothing
Conn.Close
Set Conn = Nothing
response.write "<script language=javascript>alert('会员广播信息批量更改成功！');history.go(-1);</script>"
response.End
end if


if FormatSQL(SafeRequest("action",0)) = "vip" then
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权设置VIP服务！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select webimg11 from [config]",conn,1,3
Dim strvipservice
For i = 1 To Request.Form("vipservice").Count 
strvipservice = strvipservice & Request.Form("vipservice")(i) 
Next 
rs("webimg11")=strvipservice
rs.update
rs.close
set rs=nothing
Conn.Close
Set Conn = Nothing
response.write "<script language=javascript>alert('VIP服务设置成功！');history.go(-1);</script>"
response.End
end if

if FormatSQL(SafeRequest("action",0)) = "sendmail" then
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权批量发送邮件！');history.go(-1);</script>"
response.End
end if %>

<%
Dim smtpserver,SendFrom,sendusername,sendpassword,subject,message,SendName,SendTO,MailType
set rsUser=server.createobject("adodb.recordset")
rsUser.Open "select webbj4,webbj7,webbj8,webbj9,webbj3 from config",conn,1,1
MailType = trim(rsUser("webbj4"))
smtpserver = trim(rsUser("webbj7"))
sendusername = trim(rsUser("webbj8"))
sendpassword =trim( rsUser("webbj9"))
SendName = trim(rsUser("webbj3"))
SendFrom = trim(rsUser("webbj8"))
rsUser.Close

subject=trim(request.form("MailSub"))
message=trim(request.form("MessCont"))
Intgrpid = trim(request.form("GrpID"))

rsUser.Open "Select usermail From [User]",conn,1,1
Do while not rsUser.Eof
SendTO = trim(rsUser("usermail"))
Select Case MailType
Case "Nothing"

Case "CDONTS"
call sendemail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,message)
Case "Jmail"
call SendJmail(SendFrom,SendTO,smtpserver,sendusername,sendpassword,subject,message,SendName)
End Select
Loop
rsUser.Close
response.Write "<script language='javascript'>alert('发送完成！');history.go(-1);</script>"
set rsUser = Nothing
Conn.close
Set conn = Nothing
end if

select case FormatSQL(SafeRequest("menu",0))

case "usercast"
usercast

case "VIPuser"
VIPuser

case "sendmess"
sendmess

end select

sub usercast
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
  <tr> 
    <td height="20" align="center"><font color="#FFFFFF">用户广播设置</font></td>
  </tr>
  <tr> 
    <td height="168" valign="top" bgcolor="#FFFFFF"> 
	<form name="usercast" method="post" action="cast.asp?action=save">
        <br>
        <table width="51%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
         <tr><td bgcolor="#FFFFFF" align="center">广播内容：</td></tr>
		  <tr bgcolor="#FFFFFF"> 
            <td valign="top" nowrap> <div align="center">
                <textarea name="book" cols="60" rows="8" id="book">欢迎来到网上购物网站系统,祝您购物愉快!
</textarea>
              </div></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="28" align="center"> <input type="submit" name="Submit" value="提 交">
            </td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<% 
Conn.Close
Set Conn = Nothing
end sub

sub VIPuser 
set rs = server.CreateObject("adodb.recordset")
rs.open "select webimg11 from [config]",conn,1,1
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
  <tr> 
    <td height="20" align="center"><font color="#FFFFFF">VIP会员资格设置</font></td>
  </tr>
  <tr> 
    <td height="100" valign="top" bgcolor="#FFFFFF"> 
	<form name="vipform" method="post" action="cast.asp?action=vip">
        <br>
        <table width="51%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
          <tr> 
            <td align="center" bgcolor="#FFFFFF">VIP会员享受的服务： </td>
          </tr>
          <tr> 
            <td align="center" bgcolor="#FFFFFF"> <INPUT type="hidden" name="vipservice" value="<% = Server.HtmlEncode(rs("webimg11")) %>">	
              <iframe ID="vipservice" src="htmledit/ewebeditor.asp?id=vipservice&style=standard" frameborder="0" scrolling="no" width="550" HEIGHT="350"></iframe> 
            </td>
          </tr>
          <tr> 
            <td align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit3" value="提 交"></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<% 
rs.close
set rs = nothing
Conn.Close
Set Conn = Nothing
end sub 

sub sendmess 
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
  <tr> 
    <td height="20" align="center"><font color="#FFFFFF">站内邮件群发</font></td>
  </tr>
  <tr> 
    <td height="100" valign="top" bgcolor="#FFFFFF"> 
	<form name="sendmess" method="post" action="cast.asp?action=sendmail">
        <table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF"> 
            <td>邮件标题： </td>
            <td><input name="MailSub" type="text" value="邮件标题">
			<input name="usermail" type="text" value="webmaster@timesboard.com"></td>
          </tr>
		   <tr bgcolor="#FFFFFF"> 
            <td>接受会员： </td>
            <td><% 
			set rsUser=server.createobject("adodb.recordset")
			rsUser.Open "Select GrpID,GrpName From TimesGrp"  ,conn,1,1 %>
              <select name="GrpID" id="GrpID">
			  <option value="0">所有会员</option>
                <%
		do while not rsUser.eof
		response.write  "<option value="&rsUser("GrpID")
  		response.write ">"&trim(rsUser("GrpName"))&"</option>"    
        rsUser.movenext
        loop
		rsUser.Close
		%>
              </select> 
              </select> </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>邮件正文： </td>
            <td><textarea name="MessCont" cols="60" rows="10">邮件正文</textarea></td>
          </tr>
          <tr> 
            <td colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit3" value="提 交"></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<% 
end sub 
%>
<!--#include file="footer.asp"-->