📄 message_admin.asp
字号:
<!--#include file="admin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/admin.css" rel="stylesheet" type="text/css">
<script language=javascript src="inc/select.js"></script>
</head>
<body>
<%
select case Request("menu")
case ""
msglist
case "addmsg"
chk_admin_login(1)
addmsg
case "addmsgok"
if request("touser")="" then
states=request("states")
content=request("content")
if states<>"all" then
sql="select username from [user] where state="&states&""
else
sql="select username from [user]"
end if
Set Rs=Conn.Execute(sql)
do while not rs.eof
conn.Execute("insert into message (title,fromuser,touser,content) values ('"&Request("title")&"','系统管理员','"&rs("username")&"','<font color=0000FF>【系统广播】:</font>"&content&"')")
rs.movenext
loop
rs.close
Response.write "<div align=center>发送完成! [<a href='message_admin.asp'>返回</a>]</div>"
elseif request("touser")<>"" then
If conn.Execute("Select userid From [user] where username='"&request("touser")&"'" ).eof Then
Response.Write("<div align=center>收件人不存在! [<a href='javascript:history.back()'>返回</a>]</div>")
Response.end
end if
sql="select * from [message]"
rs.Open sql,Conn,1,3
rs.addnew
rs("title")=request.form("title")
rs("fromuser")="系统管理员"
rs("touser")=request("touser")
rs("content")="<font color=0000FF>【系统广播】:</font>"+Request("content")
rs.update
rs.close
Response.redirect("message_admin.asp")
end if
case "delmsg"
chk_admin_login(3)
id=request("id")
if id="" then
Response.Write "<br><li>请指定要删除的用户</li>"
end if
if instr(id,",")>0 then
id=replace(id," ","")
sql="delete from [message] where id in (" & id & ")"
else
sql="delete from [message] where id=" & Clng(id)
end if
Conn.Execute sql
response.redirect "message_admin.asp"
case "view"
chk_admin_login(1)
id=request("id")
set rs=conn.Execute("select * from [message] where id="&id&"")
Response.Write rs("content")
rs.close
end select
sub msglist
%>
<a href="?menu=addmsg">发送短信</a><br>
<table border="0" cellpadding="5" cellspacing="1" class=a2 width=97%>
<form action="?menu=delmsg" method="post" onSubmit="return Confirm()">
<tr>
<td width="5%" align="center" height="25" class=a1>ID</td>
<td width="35%" align="center" height="25" class=a1>标题</td>
<td width="13%" align="center" height="25" class=a1>发信人</td>
<td width="12%" align="center" height="25" class=a1>收件人</td>
<td width="20%" align="center" class=a1>发布时间</td>
</tr>
<%
sql="select * from [message] order by time Desc"
rs.open sql,conn,1,1
pagesetup=20 '设定每页的显示数量
rs.pagesize=pagesetup
TotalPage=rs.pagecount '总页数
PageCount = cint(Request.QueryString("ToPage"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then rs.absolutepage=PageCount '跳转到指定页数
i=0
j=0
Do While Not RS.EOF and i<pagesetup
i=i+1
if j mod 2 = 0 then
a="a3"
else
a="a4"
end if
%>
<tr class="<%=a%>">
<td height="25" align="center"><INPUT name=id type=checkbox id="id" value=<%=rs("id")%>>
<td height="25"><a href="#" <%if rs("readed")=0 then Response.Write " style='font-weight: bold'"%> onClick="javascript:open('?menu=view&id=<%=rs("id")%>','','width=320,height=170')"><%=rs("title")%></a>
<td height="25" align="center"><%=rs("fromuser")%>
<td height="25" align="center"><a href="user_admin.asp?menu=user2&username=<%=rs("touser")%>" target="_blank"><%=rs("touser")%></a></td>
<td align="center"><%=rs("time")%></td>
</tr>
<%
j=j+1
RS.MoveNext
loop
RS.Close
%>
<tr class="a4">
<td height="25" colspan="5" align="center" bgcolor="FFFFFF"><input name=chkall type=checkbox id="chkall" onclick=CheckAll(this.form) value="ON">
全选
<input name="Submit" type="submit" id="Submit" value=" 删 除 "></tr></form>
</table>
[<b>共有
<font color="990000"><%=TotalPage%></font> 页
<script>
ShowPage(<%=TotalPage%>,<%=PageCount%>,"")
</script>
</b>]
<%
end sub
sub addmsg
%>
<table cellspacing="1" cellpadding="4" width="90%" border="0" class="a2" align="center">
<form name="coolform" method="post" action="?menu=addmsgok" onSubmit="return CheckForm(this);">
<input name="content" type="hidden">
<tr height=25>
<td class=a1 align=middle colspan=2>发布公告</td>
</tr>
<tr height=25 class=a3>
<td align=middle>接收对象:</td>
<td>
<select name="states">
<option value="all">所有用户</option>
<option value="0">未开通用户</option>
<option value="1">已开通用户</option>
<option value="2">被锁定用户</option>
</select></td>
</tr>
<tr height=25 class=a4>
<td align=middle>收件人:</td>
<td><input name="touser" type="text" size="60" value="<%=request("touser")%>">
注:如收件人为空,则向指定接收对象群发</td>
</tr>
<tr height=25 class=a3 >
<td align=middle>发件人:</td>
<td><%=Request.Cookies("9cool_name")%> [系统管理员]</td>
</tr>
<tr height=25 class=a4>
<td align=middle width="16%">
标题:</td>
<td width="82%">
<input type="text" name="title" size="60"></td></tr>
<tr height=25 class=a3>
<td width="16%" height="25" align=middle>
内容:</td>
<td width="82%" height="250"><SCRIPT src="inc/post.js"></SCRIPT></td>
</tr>
<tr align="center" height=25 class="a4">
<td colspan=2>
<input type="submit" value=" 确 定 " name=EditSubmit>
<input name="reset" type="reset" value=" 取 消 " onClick="javascript:history.back()"></td>
</tr></form></table>
<%
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -