1

<% If Not ACTCMS.ChkAdmin() Then Call Actcms.Alert("对不起，您没有操作权限！","") Dim Action,Title, Message, Numc,ShowErr Action=Trim(Request("Action")) Select Case Action Case "SaveMsg" Call SaveMsg() Case "Del" Call Del() Case "Delall" Call Delall() Case "DelChk" Call DelChk() Case Else Call Main() End Select Sub SaveMsg() Server.ScriptTimeout=99999 Dim UserType UserType = Trim(Request.Form("UserType")) Title = Trim(Request.Form("title")) Message = ACTCMS.RSQL(Request.Form("message")) If Title="" or Message="" Then ShowErr = "
- 请填写消息的标题和内容
" Response.Redirect("
- ../Error.asp?Errs="&Server.URLEncode(ShowErr)&"&ErrorUrl=
") Response.End Exit Sub End If Select Case UserType Case "1" : SaveMsg_1() '按指定用户 Case "2" : SaveMsg_2() '按指定用户组 Case "3" : SaveMsg_3() '按所有用户 Case Else Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 请输入收信的用户
")&"&ErrorUrl="&"&Title=1") Response.End End Select ShowErr = "
- 操作成功！本次发送"&Numc+1&"个用户.请继续别的操作
" Response.Redirect("../Error.asp?Errs="&Server.URLEncode(ShowErr)&"&ErrorUrl=User/Message_Admin.asp") End Sub Sub SaveMsg_1()'按指定用户 Dim ToUserName,Rs,Sql,i ToUserName = Trim(Request.Form("UserName")) If ToUserName = "" Then Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 请填写目标用户名，注意区分大小写。
")&"&ErrorUrl="&"&Title=1") Response.End Exit Sub End If ToUserName = Replace(ToUserName,"'","") ToUserName = Split(ToUserName,",") Numc= Ubound(ToUserName) For i=0 To Numc SQL = "Select UserName From User_ACT Where UserName = '"&ToUserName(i)&"'" Set Rs = Conn.Execute(SQL) If Not Rs.eof Then Conn.Execute("insert into Message_ACT (incept,sender,title,content,sendtime,flag,issend,DelR,DelS) values('"&ToUserName(i)&"','"&Session("AdminName")&"','"&Title&"','"&Message&"',"&NowString&",0,1,0,0)") End If Next Rs.Close : Set Rs = Nothing End Sub Sub SaveMsg_2() Dim GroupID,i Dim SearchStr,TempValue,DayStr GroupID = Replace(Request.Form("GroupID"),chr(32),"") If GroupID="" Then Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 请正确选取相应的用户组
")&"&ErrorUrl="&"&Title=1") Exit Sub Response.End Else GroupID = ACTCMS.RSQL(GroupID) End If DayStr = "'d'" If Instr(GroupID,",")>0 Then SearchStr = "GroupID in ("&GroupID&")" Else SearchStr = "GroupID = "&ACTCMS.RSQL(GroupID) End If If SearchStr="" Then ShowErr = "
- 请填写发送的条件选项。
" End If If ShowErr<>"" Then Response.Redirect("../Error.asp?Errs="&Server.URLEncode(ShowErr)&"&ErrorUrl="&"&Title=1") : Exit Sub Dim Rs,Sql Sql = "Select UserName From User_ACT Where "& SearchStr & " Order By UserID Desc" Set Rs = Conn.Execute(Sql) If Not Rs.eof Then SQL = Rs.GetRows(-1) Numc= Ubound(SQL,2) For i=0 To Numc Conn.Execute("insert into Message_ACT (incept,sender,title,content,sendtime,flag,issend,DelR,DelS) values('"&SQL(0,i)&"','"&Session("AdminName")&"','"&Title&"','"&Message&"',"&NowString&",0,1,0,0)") Next End If Rs.Close : Set Rs = Nothing End Sub Sub SaveMsg_3()'所有用户发送 Dim Rs,Sql,i Sql = "Select UserName From User_ACT Order By UserID Desc" Set Rs = Conn.Execute(Sql) If Not Rs.eof Then SQL = Rs.GetRows(-1) Numc= Ubound(SQL,2) For i=0 To Numc Conn.Execute("insert into Message_ACT (incept,sender,title,content,sendtime,flag,issend,DelR,DelS) values('"&SQL(0,i)&"','"&Session("AdminName")&"','"&Title&"','"&Message&"',"&NowString&",0,1,0,0)") Next End If Rs.Close : Set Rs = Nothing End Sub Sub Del() dim sql if request("username")="" then Response.Write("
") Exit Sub end if sql="delete from Message_ACT where sender='"&request("username")&"'" Conn.Execute(sql) Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 操作成功！请继续别的操作。
")&"&ErrorUrl=User/Message_Admin.asp") Response.End End Sub Sub Delall() dim selflag,sql if request("isread")="yes" then selflag="" else selflag=" and flag=1" end if select case request("delDate") case "all" sql="delete from Message_ACT where id>0 "&selflag case 7 sql="delete from Message_ACT where datediff('d',sendtime,Now())>7 "&selflag case 30 sql="delete from Message_ACT where datediff('d',sendtime,Now())>30 "&selflag case 60 sql="delete from Message_ACT where datediff('d',sendtime,Now())>60 "&selflag case 180 sql="delete from Message_ACT where datediff('d',sendtime,Now())>180 "&selflag end select Conn.Execute(sql) Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 操作成功！请继续别的操作。
")&"&ErrorUrl=User/User/Message_Admin.asp") Response.End End Sub Sub DelChk() if request.form("keyword")="" then Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 请输入关键字
")) Exit sub end if if request.form("selaction")=1 then conn.Execute("delete from Message_ACT where title like '%"&replace(request.form("keyword"),"'","")&"%'") elseif request.form("selaction")=2 then conn.Execute("delete from Message_ACT where content like '%"&replace(request.form("keyword"),"'","")&"%'") else Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 未指定相关参数！
")) end if Response.Redirect("../Error.asp?Errs="&Server.URLEncode("
- 操作成功！请继续别的操作。
")&"&ErrorUrl=User/Message_Admin.asp") End Sub Sub Main() %>

发送短消息
用户类别： | 用户名单 用户组 所有用户
用 户 名： | 请输入用户名：(多个用户名请以英文逗号“,”分隔,注意区分大小写)
用 户 组： | <%= ACTCMS.GetGroup_CheckBox("GroupID",0,5) %> 全选
消息标题： |
消息内容： |

短消息管理(批量删除)
删除指定用户短消息：
批量删除用户指定日期内短消息（默认为删除已读信息）： 包括未读信息
批量删除含有某关键字短信（注意：本操作将删除所有已读和未读信息）： 关键字： 在

<% End Sub Public Function GetGroup_CheckBox(OptionName,SelectArr,RowNum) Dim n:n=0 Dim RSObj:Set RSObj=Server.CreateObject("Adodb.Recordset") IF RowNum<=0 Then RowNum=3 RSObj.Open "Select GroupID,GroupName From Group_ACT",Conn,1,1 GetGroup_CheckBox="

" Do While Not RSObj.Eof GetGroup_CheckBox=GetGroup_CheckBox & "
" For N=1 To RowNum GetGroup_CheckBox=GetGroup_CheckBox & "
" If Instr(SelectArr,RSObj(0))<>0 Then GetGroup_CheckBox=GetGroup_CheckBox & "" & RSObj(1) & " " Else GetGroup_CheckBox=GetGroup_CheckBox & "" & RSObj(1) & " " End IF GetGroup_CheckBox=GetGroup_CheckBox & " " RSObj.MoveNext If RSObj.Eof Then Exit For Next GetGroup_CheckBox=GetGroup_CheckBox & "
" If RSObj.Eof Then Exit Do Loop GetGroup_CheckBox=GetGroup_CheckBox & "

" RSObj.Close:Set RSObj=Nothing End Function %>