⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_message.asp

📁 基于asp的网站管理系统,课直接下载使用,对初学者有恨大帮助,希望对大家有用
💻 ASP
📖 第 1 页 / 共 2 页
字号:
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" width="4" height="7"><img src="images/b1.gif" width="4" height="7" alt=""></td>
<td height="7" background="images/b2.gif"><img  height="7"></td>
<td align="right" width="4" height="7"><img src="images/b3.gif" width="4" height="7" alt=""></td>
</tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" bgcolor="#99CCFF" width="100%" height="590">
<tr>
<td align="left" width="4" background="images/sidebox-content-left.gif"><img src="images/sidebox-content-left.gif" width="4" height="1" alt=""></td>
<td bgcolor="#99CCFF" valign='top'>

<%
if session("admin")="" then
response.write "<br><br><br><br><center><font color=red>你还没有登录本站呢。不能进入管理后台!!</font><br><br>请先登录再进入管理后台!!谢谢合作!!</center>"
end if
%>
<%if session("admin")<>"" then%>
<%if request("action")="" then%>
<center><br><br><br><Font color=red size=+2>请选择右边的菜单进行管理。谢谢合作。</font></center>
<%end if%>

<%if request("action")="view" then%>

<%
set rs=server.createobject("adodb.recordset") 
sql="select * from message order by id desc"
rs.open sql,db,1,1
dim pagenum
rs.pagesize=18
pagecount1=rs.pagecount
if request.querystring("pagenum")=0 or request.querystring("pagenum")="" then
pagenum=1
else
pagenum=request.querystring("pagenum")
rs.absolutepage=trim(request.querystring("pagenum"))
end if

%>
<table width="100%" border="0" align="center" cellspacing="0">
  <tr align='center' bgcolor="#006699"> 
    <td width="38%" align='left'><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;标题</font></td>
    <td width="12%" height="25" align='left'><font color="#FFFFFF">发送者</font></td>
    <td width="12%" align='left'><font color="#FFFFFF">接受者</font></td>
    <td width="20%" align='left'><font color="#FFFFFF">发送时间</font></td>
    <td width="10%" align='center'><font color="#FFFFFF">是否已读</font></td>
    <td width="8%"><font color="#FFFFFF">删除</font></td>
  </tr>
  <%do while not rs.eof and i<18%>
  <tr align='center'>
    <td align='left'><img src='images/arrow2.gif' border='0'>&nbsp;&nbsp;<a href='message.asp?id=<%=rs("id")%>' target='_blank'><%=rs("title")%></a></td>
    <td align='left'><%=rs("from")%></td>
    <td align='left'><%=rs("to")%></td>
    <td align='left'><%=rs("date")%></td>
    <td align='center'><%=rs("isread")%></td>
    <td><a href=admin_message.asp?action=del&id=<%=rs("id")%>>删除</a></td>
  </tr>
  <%
  i=i+1
  rs.movenext
  loop
  %>
</table>
<p align="center"><a href=admin_message.asp?action=view&pagenum=1>首页</a>
              <%if pagenum>1 then%>
			<a href=admin_message.asp?action=view&pagenum=<%=(pagenum-1)%>>上一页</a>
			<%else%>
			上一页
			<%end if%> 
			<%if pagenum < trim(pagecount1) then%>
			<a href=admin_message.asp?action=view&pagenum=<%=(pagenum+1)%>>下一页</a>
			<%else%>
			下一页
			<%end if%> <a href=admin_message.asp?action=view&pagenum=<%=pagecount1%>>尾页</a> 
</p>
<% rs.close %>
<p align=center>
<input type=button value=" 发 送 新 消 息 " onClick="document.location='admin_message.asp?action=send'">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type=button value=" 批 量 删 除 消 息 " onClick="document.location='admin_message.asp?action=delall'">
</p>
<% end if %>

<%if request("action")="send" then%>
<br><br>
<script language=javascript>
<!--
function send_check()
{
  if (send.title.value=="")
  { alert("请填写 消息标题 !\n\n必须>=2个字符(1个汉字)且必须<=20个字符(10个汉字)"); return false; }
  if (send.to.value=="")
  { alert("请填写 接受者! "); return false; }
  if (send.content.value=="")
  { alert("请填写 消息内容 !"); return false; }
}
-->
</script>
 <table border=0 width='100%' cellspacing=0 cellpadding=2>
  <form name=send action='admin_message.asp?action=sendok' method=post>
  <tr valign='top'><td width='20%' align=right>发送给:</td><td><input type=text name='to' size=35 maxlength=80>&nbsp;&nbsp;<font color='#ff0000'>*</font></td></tr>
  <tr valign='top'><td width='20%' align=right>消息标题:</td><td><input type=text name='title' size=35 maxlength=80>&nbsp;&nbsp;<font color='#ff0000'>*</font></td></tr>
  <tr><td height='10'> </td></tr>
   <tr valign='top'><td align=right>消息内容:</td><td><textarea rows=18 name='content' cols=80 maxlength=1000></textarea>&nbsp;&nbsp;<font color='#ff0000'>*</font></td></tr>
     <tr><td height='10'> </td></tr>
  <tr><td></td><td><input type=submit value=' 发 送 ' onclick="return send_check()">&nbsp;&nbsp; <input type=button value=' 返 回 ' onClick="document.location='admin_message.asp?action=view'"></td></tr>
  </form>
  </table>
<p><font color=red>&nbsp;&nbsp;&nbsp;添加说明:</font>带*号的为必填项,请认真填写!支持HTML语言!呵呵。</p>
<% end if %>

<%if request("action")="sendok" then%>

<%
on error resume next
from=session("realname")
touser=trim(request("to"))
content=request("content")
title=trim(request("title"))
date="Now()"
sql="select * from user where user='"&touser&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,db,1,1
    if rs.eof and rs.bof then
       response.write "<br><br><br><br><br><center><font color=red size=1>对不起,该用户不存在!请正确输入用户名!</font><br><br><a href='admin_message.asp?action=send'>返回重发</a></center>"
   response.end
     else
      sql="select * from message"
      set rs=server.createobject("adodb.recordset")
      rs.open sql,db,1,3
      rs.addnew
      rs("from")=from
      rs("to")=touser
      rs("content")=content
      rs("date")=date
      rs("title")=title
      rs.update
      rs.close
    end if
rs.close
%>

<%
if db.errors.count>0 then
response.write "<br><br><br><br><br><center><font color=red>保存过程中发生错误,必须重新填写!<br><br><a href='admin_message.asp?action=send'>返回重新发送</a>"
else
response.write "<br><br><br><br><br><center><font color=red>恭喜你!你已经成功发送消息!!<br><br><a href='admin_message.asp?action=send'>返回继续发送</a>"
end if
%>

<% end if %>

<%if request("action")="del" then%>
<%
id=trim(request("id"))
sql="delete * from message where id="&id
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=view'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=view'>返回继续删除</a>"
end if
%>

<% end if %>

<%if request("action")="delall" then%>
<br>
 <table border=0 width='100%' cellspacing=0 cellpadding=2>
  <form name=send action='admin_message.asp?action=delallok&type=rec' method=post>
  <tr valign='top'><td width='20%' align=right>用户名:</td><td><input type=text name='to' size=20 maxlength=20>&nbsp;&nbsp;<font color='#ff0000'>*</font>&nbsp;&nbsp;<input type=submit value=' 删除该用户所有接收消息 '></td></tr>
  </form>
  <form name=send action='admin_message.asp?action=delallok&type=send' method=post>
  <tr valign='top'><td width='20%' align=right>用户名:</td><td><input type=text name='from' size=20 maxlength=20>&nbsp;&nbsp;<font color='#ff0000'>*</font>&nbsp;&nbsp;<input type=submit value=' 删除该用户所有发送消息 '></td></tr>
  </form>
<form name=send action='admin_message.asp?action=delallok&type=userisread' method=post>
  <tr valign='top'><td width='20%' align=right>用户名:</td><td><input type=text name='to' size=20 maxlength=20>&nbsp;&nbsp;<font color='#ff0000'>*</font>&nbsp;&nbsp;<input type=submit value=' 删除该用户所有已读消息 '></td></tr>
  </form>
  <form name=send action='admin_message.asp?action=delallok&type=usernoread' method=post>
  <tr valign='top'><td width='20%' align=right>用户名:</td><td><input type=text name='to' size=20 maxlength=20>&nbsp;&nbsp;<font color='#ff0000'>*</font>&nbsp;&nbsp;<input type=submit value=' 删除该用户所有未读消息 '></td></tr>
  </form>
  </table>
<p align=center>
  <form name=send action='admin_message.asp?action=delallok&type=isread' method=post>
<input type=submit value=' 删除所有已读消息 '>
  </form>
  <form name=send action='admin_message.asp?action=delallok&type=noread' method=post>
<input type=submit value=' 删除所有未读消息 '>
  </form>
  <form name=send action='admin_message.asp?action=delallok&type=all' method=post>
<input type=submit value=' 删除所有消息 '>
  </form>
</p>

<% end if %>

<%if request("action")="delallok" then%>

<%if request("type")="rec" then%>
<%
touser=trim(request("to"))
sql="delete * from message where to='"&touser&"'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="send" then%>
<%
from=trim(request("from"))
sql="delete * from message where from='"&from&"'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="userisread" then%>
<%
touser=trim(request("to"))
sql="delete * from message where to='"&touser&"' and isread='是'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="usernoread" then%>
<%
touser=trim(request("to"))
sql="delete * from message where to='"&touser&"' and isread='否'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="isread" then%>
<%
touser=trim(request("to"))
sql="delete * from message where isread='是'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="noread" then%>
<%
touser=trim(request("to"))
sql="delete * from message where isread='否'"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<%if request("type")="all" then%>
<%
touser=trim(request("to"))
sql="delete * from message"
db.execute(sql)

if db.errors.count>0 then
response.write "<br><br><br><center><font color=red>删除过程中发生错误,必须重新删除!<br><br><a href='admin_message.asp?action=delall'>返回重新删除</a>"
else
response.write "<br><br><br><center><font color=red>恭喜你!你已经成功删除消息!<br><br><a href='admin_message.asp?action=delall'>返回继续删除</a>"
end if
%>
<% end if %>

<% end if %>

<% end if %>

</td>
<td align="left" width="4" background="images/sidebox-content-right.gif"><img src="images/sidebox-content-right.gif" width="4" height="1" alt=""></td>
</tr>
</table>
</td>

<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td><img src="images/column-footer.gif" width="780" height="16" border="0" alt=""></td>
</tr>
</table>


<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td><img src="images/footer.gif" width="780" height="20" border="0" alt=""></td>
</tr>
</table>

<!-- footer -->
<table width="780" cellpadding="0" cellspacing="0" border="0" align="center">
<tr align="center">
<td width="100%" colspan="3"><%
set rs=server.createobject("adodb.recordset") 
sql="select top 1 copyright from system order by id desc"
rs.open sql,db,1,1
%>
<%=rs("copyright")%>
<% rs.close %>
</td>
</tr>
</table>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -