📄 admin_message.asp
字号:
case 30
sql="delete from "&Db.MessageTable&" where datediff('d',sendtime,Now())>30 "&selflag
case 60
sql="delete from "&Db.MessageTable&" where datediff('d',sendtime,Now())>60 "&selflag
case 180
sql="delete from "&Db.MessageTable&" where datediff('d',sendtime,Now())>180 "&selflag
end select
end if
if UserTableType="Dvbbs" then
Cl.Execute_U(sql)
else
Cl.Execute(sql)
end if
Cl.SaveAdminLog
Call Cl.ShowSuc("<br />操作成功!请继续别的操作。")
end Sub
Sub delchk()
if request("keyword")="" then
Cl.ShowErr("请输入关键字!")
Exit sub
end if
if request("selaction")=1 then
if UserTableType="Dvbbs" then
Cl.Execute_U("delete from "&Db.MessageTable&" where title like '%"&replace(request("keyword"),"'","")&"%'")
else
Cl.Execute("delete from "&Db.MessageTable&" where title like '%"&replace(request("keyword"),"'","")&"%'")
end if
elseif request("selaction")=2 then
if UserTableType="Dvbbs" then
Cl.Execute_U("delete from "&Db.MessageTable&" where content like '%"&replace(request("keyword"),"'","")&"%'")
else
Cl.Execute("delete from "&Db.MessageTable&" where content like '%"&replace(request("keyword"),"'","")&"%'")
end if
else
Cl.ShowErr("未指定相关参数!")
end if
Cl.SaveAdminLog
Call Cl.ShowSuc("<br />操作成功!请继续别的操作。")
End Sub
Sub SaveMsg()
Server.ScriptTimeout=99999
Dim UserType
UserType = Trim(Request("UserType"))
Title = Trim(Request("title"))
Message = Cl.CheckStr(Request("message"))
If Title="" or Message="" Then
Cl.ShowErr("请填写消息的标题和内容!")
Exit Sub
End If
If Len(Message) > 255 Then
Cl.ShowErr("消息内容不能多于255字节")
Exit Sub
End If
Select Case UserType
Case "0" : SaveMsg_0() '按所有用户
Case "1" : SaveMsg_1() '按指定用户
Case "2" : SaveMsg_2() '按指定用户组
Case Else
Cl.ShowErr("请选收信的用户!") : Exit Sub
End Select
Cl.SaveAdminLog
Call Cl.ShowSuc("<br />操作成功!本次发送<b><font color=red>"&Numc+1&"</font></b>个用户。请继续别的操作。")
End Sub
'按指定用户组及条件发送
Sub SaveMsg_0()
Dim Rs,Sql
Sql = "Select "&Db.UserName&" From "&Db.UserTable&" Order By UserID Desc"
Set Rs = Cl.Execute_U(Sql)
If Not Rs.eof Then
SQL = Rs.GetRows(-1)
Numc= Ubound(SQL,2)
For i=0 To Numc
Cl.Execute_U("insert into "&Db.MessageTable&" (incept,sender,title,content,sendtime,flag,issend) values('"&SQL(0,i)&"','"&Cl.Web_Info(0)&"','"&Title&"','"&Message&"',"&SqlNowString_U&",0,1)")
Next
End If
Rs.Close : Set Rs = Nothing
End Sub
'按指定用户
Sub SaveMsg_1()
Dim ToUserName,Rs,Sql,i
ToUserName = Trim(Request("UserName"))
If ToUserName = "" Then
Cl.ShowErr("请填写目标用户名,注意区分大小写。")
End If
ToUserName = Replace(ToUserName,"'","")
ToUserName = Split(ToUserName,",")
Numc= Ubound(ToUserName)
For i=0 To Numc
SQL = "Select " & Db.UserName & " From "&Db.UserTable&" Where "&Db.UserName&" = '"&ToUserName(i)&"'"
Set Rs = Cl.Execute_U(SQL)
If Not Rs.eof Then
Cl.Execute_U("insert into "&Db.MessageTable&" (incept,sender,title,content,sendtime,flag,issend) values('"&ToUserName(i)&"','"&Cl.Web_info(0)&"','"&Title&"','"&Message&"',"&SqlNowString_U&",0,1)")
End If
Next
Rs.Close : Set Rs = Nothing
End Sub
'按指定用户组及条件发送
Sub SaveMsg_2()
Dim UserGroupID
Dim SearchStr,TempValue,DayStr
UserGroupID = Replace(Request("UserGroupID"),chr(32),"")
If UserGroupID<>"" and Not Isnumeric(Replace(UserGroupID,",","")) Then
ErrMsg = "请正确选取相应的用户组。"
Else
UserGroupID = Cl.Checkstr(UserGroupID)
End If
If IsSqlDataBase_U=1 Then
DayStr = "d"
Else
DayStr = "'d'"
End If
If Instr(UserGroupID,",")>0 Then
SearchStr = Db.UserGroupID & " in ("&UserGroupID&")"
Else
SearchStr = Db.UserGroupID & " = "&Cl.GetClng(UserGroupID)
End If
'登陆次数
TempValue = Request("Logins")
If TempValue<>"" and IsNumeric(TempValue) Then
SearchStr = GetSearchString(TempValue,SearchStr,Request("LoginsType"),"UserLogins")
End If
'发表文章
TempValue = Request("UserArticle")
If TempValue<>"" and IsNumeric(TempValue) Then
SearchStr = GetSearchString(TempValue,SearchStr,Request("UserArticleType"),"UserArticle")
End If
'最后登陆时间
TempValue = Request("LoginTime")
If TempValue<>"" and IsNumeric(TempValue) Then
SearchStr = GetSearchString(TempValue,SearchStr,Request("LoginTimeType"),"Datediff("&DayStr&",Lastlogin,"&SqlNowString_U&")")
End If
'注册时间
TempValue = Request("RegTime")
If TempValue<>"" and IsNumeric(TempValue) Then
SearchStr = GetSearchString(TempValue,SearchStr,Request("RegTimeType"),"Datediff("&DayStr&",JoinDate,"&SqlNowString_U&")")
End If
If SearchStr="" Then
ErrMsg = "请填写发送的条件选项。"
End If
If ErrMsg<>"" Then Cl.ShowErr(ErrMsg) : Exit Sub
Dim Rs,Sql
Sql = "Select "&Db.UserName&" From "&Db.UserTable&" Where "& SearchStr & " Order By UserID Desc"
Set Rs = Cl.Execute_U(Sql)
If Not Rs.eof Then
SQL = Rs.GetRows(-1)
Numc= Ubound(SQL,2)
For i=0 To Numc
Cl.Execute_U("insert into "&Db.MessageTable&" (incept,sender,title,content,sendtime,flag,issend) values('"&SQL(0,i)&"','"&Cl.Web_Info(0)&"','"&Title&"','"&Message&"',"&SqlNowString_U&",0,1)")
Next
End If
Rs.Close : Set Rs = Nothing
End Sub
Function GetSearchString(Get_Value,Get_SearchStr,UpType,UpColumn)
Get_Value = Clng(Get_Value)
If Get_SearchStr<>"" Then Get_SearchStr = Get_SearchStr & " and "
If UpType="1" Then
Get_SearchStr = Get_SearchStr & UpColumn &" <= "&Get_Value
Else
Get_SearchStr = Get_SearchStr & UpColumn &" >= "&Get_Value
End If
GetSearchString = Get_SearchStr
End Function
Function inceptid(stype,iusername)
Dim ars
set ars=Cl.Execute_U("Select top 1 id,sender from "&Db.MessageTable&" Where flag=0 and issend=1 and delR=0 And incept ='"& iusername &"'")
if stype=1 then
inceptid=ars(0)
else
inceptid=ars(1)
end if
set ars=nothing
End Function
Function update_user_msg(username)
Dim msginfo
If newincept(username)>0 Then
msginfo=newincept(username) & "||" & inceptid(1,username) & "||" & inceptid(2,username)
Else
msginfo="0||0||null"
End If
Cl.Execute_U("update "&Db.UserTable&" set UserMsg='"&Cl.CheckStr(msginfo)&"' where username='"&Cl.CheckStr(username)&"'")
End Function
'统计留言
Function newincept(iusername)
Dim rs
Rs=Cl.Execute_U("Select Count(id) from "&Db.MessageTable&" Where flag=0 and issend=1 and delR=0 And incept='"& iusername &"'")
newincept=Rs(0)
Set Rs=Nothing
If IsNull(newincept) Then newincept=0
End Function
'搜索
Sub MessageSearch()
If request("action")="" or request("MessageSearch")="0" Then Exit Sub End If
Dim stype,sqlstr,Sql1
Dim CurrentPage,page_count,totalrec,Pcount,endpage
Dim PageListNum,SearchStr,Colspan:Colspan=9
Dim orderby,seldesc,TmpSmax
'=======================搜索参数=======================
If request("searchmax")<>"" Then
If IsNumeric(request("searchmax")) Then
TmpSmax="Top "&Cint(request("searchmax"))
Else
Cl.ShowErr(Errmsg+"<br /><li>错误的参数!")
End If
Else
TmpSmax=""
End If
select case request("MessageSearch")
case "1"
stype="列出用户所有短信"
case "2"
stype="用户已删除的短信"
case "3"
stype="用户已查看的短信"
case "4"
stype="用户未查看的短信"
case "5"
stype="用户已发送的短信"
case "6"
stype="最近24小时内发送"
case else
stype="按条件高级查询"
end select
select case request("orderby")
case "1"
orderby="sender"
case "2"
orderby="incept"
case "3"
orderby="title"
case "4"
orderby="content"
case "5"
orderby="flag"
case "6"
orderby="sendtime"
case "7"
orderby="delR,delS"
case "8"
orderby="isSend"
case else
orderby="sendtime"
end select
select case request("seldesc")
case "1"
seldesc=" desc"
case "2"
seldesc=""
case else
seldesc=" desc"
end select
sqlstr=""
sql="select id,sender,incept,title,content,flag,sendtime,delR,delS,isSend from "&Db.MessageTable&""
select case request("MessageSearch")
case 1
sqlstr=""
Sql=Sql+" order by "&orderby&seldesc
case 2
sqlstr=" delR=1 or delS=1"
Sql=Sql+" where"+sqlstr+" order by "&orderby&seldesc
case 3
sqlstr=" flag=1"
Sql=Sql+" where"+sqlstr+" order by "&orderby&seldesc
case 4
sqlstr=" flag=0"
Sql=Sql+" where"+sqlstr+" order by "&orderby&seldesc
case 5
sqlstr=" isSend=1"
Sql=Sql+" where"+sqlstr+" order by "&orderby&seldesc
case 6
If IsSqlDataBase_U = 1 Then
sqlstr=" datediff(hour,sendtime,"&SqlNowString_U&")<25"
Else
sqlstr=" datediff('h',sendtime,"&SqlNowString_U&")<25"
End If
Sql=Sql+" where"+sqlstr+" order by "&orderby&seldesc
case 9
if request("sender")<>"" then
if request("senderchk")="yes" then
sqlstr=" sender='"&request("sender")&"'"
else
sqlstr=" sender like '%"&request("sender")&"%'"
end if
end if
if request("incept")<>"" then
if request("inceptchk")="yes" then
sqlstr=" incept='"&request("incept")&"'"
else
sqlstr=" incept like '%"&request("incept")&"%'"
end if
end if
if request("title")<>"" then
if sqlstr="" then
sqlstr=" title like '%"&request("title")&"%'"
else
sqlstr=sqlstr & " and title like '%"&request("title")&"%'"
end if
end if
if request("content")<>"" then
if sqlstr="" then
sqlstr=" content like '%"&request("content")&"%'"
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -