www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > admin/admin_sendmsg.asp

    <!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%CheckAdmin%>
<%
dim action,msg
action=Request.QueryString ("action")
if action="save" then
	title=trim(Request.Form ("title"))
	content=trim(Request.Form ("content"))
	if title="" then
		conn.close 
		set conn=nothing
		errmsg="<li>短信息标题没有填写!请返回填写完整。</li>"
    	call error()
		Response.End 
	elseif content="" then
		conn.close
		set conn=nothing
		errmsg="<li>短信息内容没有填写!请返回填写完整。</li>"
    	call error()
		Response.End 
	end if
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select username from [user]"
	rs.Open sql,conn,1,1
	if not rs.EOF then
		sendtime=now()
		sender="短信精灵"
		do while not rs.EOF 
			sql="insert into message(incept,sender,title,content,sendtime) values('"
			sql=sql&(rs("username"))&"','"
			sql=sql&(sender)&"','"
			sql=sql&(title)&"','"
			sql=sql&(content)&"','"
			sql=sql&(sendtime)&"')"
			conn.execute(sql)
		rs.MoveNext 
		loop
	end if
	if err then
		conn.close
		set conn=nothing
		Response.Write err.description
		Response.End 
	else
		msg="发送成功!"
	end if
	rs.Close 
	set rs=nothing
elseif action="del" then
	UserName=trim(Request.Form ("UserName"))
	DelR=trim(Request.Form ("delR"))
	DelW=trim(Request.Form ("delW"))
	if UserName="短信精灵" then
		conn.execute("delete * from message")
		msg="成功删除所有短信息"
	elseif DelR="on" or DelW="on" then
		if DelR="on" and DelW<>"on" then
			sql="delete * from message where incept='"&UserName&"'"
			thismsg="收到"
		elseif DelR<>"on" and DelW="on" then
			sql="delete * from message where sender='"&UserName&"'"
			thismsg="发出"
		elseif DelR="on" and DelW="on" then
			sql="delete * from message where sender='"&UserName&"' or incept='"&UserName&"'"
			thismsg="所有"
		end if
		conn.execute(sql)
		msg="成功删除用户"&UserName&thismsg&"的短信息"
	end if
elseif action="deldate" then
	thisdate=date()
	selectdate=cint(trim(Request.Form ("selectdate")))
	conn.execute("delete * from message where datediff('d',datevalue(sendtime),#"& thisdate &"#)>"& selectdate &" and flag<>0")
	msg="成功删除"&selectdate&"天前的短信息"
elseif action="delweek" then
	thisdate=date()
	conn.execute("delete * from message where datediff('d',datevalue(sendtime),#"& thisdate &"#)>7 and flag<>0")
	msg="成功删除一周前的短信息"
elseif action="delmonth" then
	thisdate=date()
	conn.execute("delete * from message where datediff('d',datevalue(sendtime),#"& thisdate &"#)>30 and flag<>0")
	msg="成功删除一个月前的短信息"
end if	
%>
<html>
<head>
<title>迪吧后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber2">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>短 信 精 灵</strong></td>
  </tr>
</table>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber3">
<form method="POST" action="admin_sendmsg.asp?action=save" id=form1 name=form1>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title"><strong>使 用 说 明</strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="100%" colspan="2">
    <li>短信精灵将会对所有注册用户同时发出短信息。</li>
           <li>短信精灵能删除某个人甚至所有人的短信息,还能删除过期短信息。</li>
           <li>如想删除所有人的短信息,请在用户栏内输入“短信精灵”。请慎用!</li>
           <li>过期短信息不包括未读的短信息。</li>
</td>
    </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title"><strong>发送统一短信息</strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="30%" align="right"><strong>短信息标题:</strong></td>
      <td width="70%" height="30"><input type="text" name="title" size="35"><select size="1" name="touser">
             <option>发送对象</option>
             <option value="tovip">VIP会员</option>
             <option value="toalluser">所有用户</option>
             </select></td>
    </tr>
    <tr class="tdbg"> 
      <td width="30%" align="right"><strong>短信息内容:</strong></td>
      <td width="70%" height="30"><TEXTAREA name=content rows=6 cols=47></TEXTAREA></td>
    </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title">
             <input type="submit" value=" 确定 " name="cmdok">&nbsp; 
             <input type="reset" value=" 清 除 "  name="cmdcancel">
        </td>
    </tr></form>
  </table>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber2">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>删 除 用 户 短 信 息</strong></td>
  </tr>
</table>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber3">
       <form method="POST" action="admin_sendmsg.asp?action=del" id=form2 name=form2>
    <tr class="tdbg"> 
      <td width="50%" align="right"><strong>短信息内容:</strong></td>
      <td width="50%" height="30"><input type="checkbox" name="delR" checked style='background-color:#c0c0c0; border: 0' value="ON">包含收到的短信息</td>
    </tr>
    <tr class="tdbg"> 
      <td width="50%" align="right"><strong>短信息内容:</strong></td>
      <td width="50%" height="30"><input type="checkbox" name="delW" checked style='background-color:#c0c0c0; border: 0' value="ON">包含发出的短信息</td>
    </tr>
    <tr class="tdbg"> 
      <td width="50%" align="right"><strong>用户名:</strong></td>
      <td width="50%" height="30"><input type="text" name="UserName" size="20"></td>
    </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title">
             <input type="submit" value=" 确定 " name="cmdok">&nbsp; 
             <input type="reset" value=" 清 除 "  name="cmdcancel">
        </td>
    </tr></form>
  </table>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber2">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>删 除 过 期 短 信 息</strong></td>
  </tr>
</table>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border" id="AutoNumber3">
<form method="POST" action="admin_sendmsg.asp?action=deldate" id=form1 name=form1>
    <tr class="tdbg"> 
      <td width="100%" align=center colspan="2"><strong><a href="admin_sendmsg.asp?action=delweek">删除一周前的短信息</a></strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="100%" align=center colspan="2"><strong><a href="admin_sendmsg.asp?action=delmonth">删除一个月前的短信息</a></strong></td>
    </tr>
    <tr class="tdbg"> 
      <td width="50%" align="right"><strong>自定义天数:</strong></td>
      <td width="50%" height="30"><input type="text" name="selectdate" size="20"></td>
    </tr>
    <tr class="tdbg"> 
      <td height="22" colspan="2" align="center" class="title">
             <input type="submit" value=" 确定 " name="cmdok">&nbsp; 
             <input type="reset" value=" 清 除 "  name="cmdcancel">
        </td>
    </tr></form>
  </table>
</body> 
</html>