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

📄 webmsg_manage.asp

📁 视频点播系统
💻 ASP
字号:
<!--#include file="chklogin.asp"-->
<%

call myobj.chkrq()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理站内短信</title>
<link href="images/style2.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
}
a:link {
	color: #0000FF;
	text-decoration: none;
}
a:visited {
	color: #0000FF;
	text-decoration: none;
}
a:hover {
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
-->
</style>
<script language="JavaScript">
function tourl(form1_url){
    location=form1_url;
    for(var i=0;i<document.form1.elements.length;i++){
        document.form1.elements[i].options[0].selected=true
    }
}
</script>
<script language="vbscript">
function show_var()
if form2.sql.value="search_msg_title" or form2.sql.value="search_from_userid" or form2.sql.value="search_to_userid" then
    document.GetElementById("var").style.display="inline"
else
	document.GetElementById("var").style.display="none"
end if
end function
</script>
</head>

<body leftMargin="0" topMargin="0" bgcolor="#FFFFFF">
<%
action_e=request.Querystring("action")
Select Case action_e
	Case ""
	  Call main()
end select
%>
<%
sub main
%>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="550" height="25" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#3975CE">
  <tr>
    <td align="center" class="font1"><strong class="font1">站内短信管理</strong></td>
  </tr>
</table>
<table width="550" height="30" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
  <tr>
<form name="form2" method="get" action="<%=filename%>">
    <td align="center" bgcolor="#F7F7F7">
	<select name="sql" class="select1" id="sql" onChange="vbscript:show_var()">
      <option value="" <%if request.QueryString("sql")="" then%>selected<%end if%>>所有站内短信</option>
      <option value="all_rq" <%if request.QueryString("sql")="all_rq" then%>selected<%end if%>>已接收的短信</option>
      <option value="all_send" <%if request.QueryString("sql")="all_send" then%>selected<%end if%>>已发送的短信</option>
      <option value="search_msg_title" <%if request.QueryString("sql")="search_msg_title" then%>selected<%end if%>>在接收的短信标题中搜索关键字</option>
      <option value="search_from_userid" <%if request.QueryString("sql")="search_from_userid" then%>selected<%end if%>>在已接收的短信中搜索发送短信的用户</option>
      <option value="search_to_userid" <%if request.QueryString("sql")="search_to_userid" then%>selected<%end if%>>在已发送的短信中搜索接收短信的用户</option>
    </select>
    <input name="var" type="text" class="input1" id="var" size="15" <%if request.querystring("sql")<>"search_msg_title" and request.querystring("sql")<>"search_from_userid" and request.querystring("sql")<>"search_to_userid" then%>style="display:none"<%end if%>>
    <input name="Submit" type="submit" class="button1" value="确定"> 
    <a href="webmsg_send.asp">发送短信</a>  <a href="webmsg_del.asp">删除已读短信</a></td>
</form>
  </tr>
</table>
<table width="550" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">搜索条件:<span class="font3"><%if request.QueryString("sql")="" then%>
      所有站内短信
          <%end if%><%if request.QueryString("sql")="all_rq" then%>
      已接收的短信
          <%end if%>
          <%if request.QueryString("sql")="all_send" then%>
          已发送的短信
          <%end if%>
          <%if request.QueryString("sql")="search_from_userid" then%>
          用户:<%=request.querystring("var")%> 发送的短信
          <%end if%>
          <%if request.QueryString("sql")="search_to_userid" then%>
发送给用户:<%=request.querystring("var")%> 的短信
<%end if%>
          <%if request.QueryString("sql")="search_msg_title" then%>
          标题中包含:<%=request.querystring("var")%>的短信
          <%end if%>
</span></td>
  </tr>
</table>
<%
if request.QueryString("sql")="" then
set rs=server.createobject("adodb.recordset")
rs.open "select * from webmessage where to_userid='@admin@' or from_userid='@admin@' order by id desc,is_read desc",conn,1,1
end if

if request.QueryString("sql")="all_rq" then
set rs=server.createobject("adodb.recordset")
rs.open "select * from webmessage where to_userid='@admin@' order by id desc,is_read desc",conn,1,1
end if

if request.QueryString("sql")="all_send" then
set rs=server.createobject("adodb.recordset")
rs.open "select * from webmessage where from_userid='@admin@' order by id desc,is_read desc",conn,1,1
end if

if request.QueryString("sql")="search_from_userid" then
	if request.querystring("var")="" or myobj.ChkID(request.querystring("var"))=false then
		response.write"<script>alert('您输入的不是一个有效的用户账号');history.back();</Script>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from member where userid like '%"&request.Querystring("var")&"%'",conn,1,1
	if rs.eof then
		rs.close
		set rs=nothing
		response.write"<script>alert('您输入的用户账号并不存在');history.back();</Script>"
		response.end
	else
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from webmessage where from_userid like '%"&request.Querystring("var")&"%' order by id desc,is_read desc",conn,1,1
	end if
end if

if request.QueryString("sql")="search_to_userid" then
	if request.querystring("var")="" or myobj.ChkID(request.querystring("var"))=false then
		response.write"<script>alert('您输入的不是一个有效的用户账号');history.back();</Script>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from member where userid like '%"&request.Querystring("var")&"%'",conn,1,1
	if rs.eof then
		rs.close
		set rs=nothing
		response.write"<script>alert('您输入的用户账号并不存在');history.back();</Script>"
		response.end
	else
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from webmessage where to_userid like '%"&request.Querystring("var")&"%' order by id desc,is_read desc",conn,1,1
	end if
end if

if request.QueryString("sql")="search_msg_title" then
	if request.querystring("var")="" then
		response.write"<script>alert('请输入要搜索的短信标题');history.back();</Script>"
		response.end
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from webmessage where msg_title like '%"&request.Querystring("var")&"%' order by id desc,is_read desc",conn,1,1
end if

if rs.eof and rs.bof then
%>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
  <tr>
    <td height="100" align="center" bgcolor="#F7F7F7">没有搜索到任何符合条件的站内短信</td>
  </tr>
</table>
<%
else

maxpage=10 '每页最大显示数
dim totalhow  '数据库中的总记录数
dim totalpage '总共页数
dim CurrentPage '当前处于的页数
currentPage=request.Querystring("page")
totalhow=rs.recordcount
if totalhow mod maxpage=0 then
totalpage= totalhow \ maxpage
else
totalpage = totalhow \ maxpage +1
end if


if currentpage<1 then
   currentpage=1
end if
if (currentpage-1)*MaxPage>totalhow then
   if (totalhow mod MaxPage)=0 then
      currentpage= totalhow \ MaxPage
	   else
      currentpage= totalhow \ MaxPage + 1
   end if
end if
if (currentPage-1)*MaxPage<totalhow then
    rs.move (currentPage-1)*MaxPage
    else
    currentPage=1
end if
%>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
  <tr>
<%if request.QueryString("sql")="all_rq" then%>
    <td height="25" align="center" bgcolor="#F7F7F7"><%if request.querystring("sql")="all_rq" then%>来自<%end if%><%if request.querystring("sql")="all_send" then%>接收<%end if%>用户</td>
    <%end if%>
    <td height="25" align="center" bgcolor="#F7F7F7">收/发</td>
    <td height="25" align="center" bgcolor="#F7F7F7">状态</td>
    <td height="25" align="center" bgcolor="#F7F7F7">短信标题</td>
    <td align="center" bgcolor="#F7F7F7">发送时间</td>
    <td align="center" bgcolor="#F7F7F7">&nbsp;操作&nbsp;</td>
  </tr>
  <%
i=0
do while not rs.eof
i=i+1
%>
  <tr>
<%if request.QueryString("sql")="all_rq" then%>
    <td height="25" align="center" bgcolor="#FFFFFF"><%if rs("from_userid")="@admin@" then%><span class="font4">管理员</span><%else%><%=rs("from_userid")%><%end if%></td>
<%end if%>
    <td height="25" align="center" bgcolor="#FFFFFF"><%if rs("to_userid")="@admin@" then%><span class="font4">收</span><%else%><span class="font3">发</span><%end if%></td>
    <td height="25" align="center" bgcolor="#FFFFFF"><%if rs("is_read")=false then%><span title="未读"><img src="images/noread.gif" alt="<%if rs("from_userid")="@admin@" then%>用户善未查阅该条短信<%else%>您还没有查阅该条短信<%end if%>"></span>
      <%end if%></td>
    <td height="25" align="center" bgcolor="#FFFFFF"><%if myobj.ChkLen(rs("msg_title"))>10 then%><span title="<%=rs("msg_title")%>"><%=left(rs("msg_title"),10)%>……</span><%else%><%=rs("msg_title")%><%end if%></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs("msg_time")%></td>
    <td align="center" bgcolor="#FFFFFF"><a href="webmsg_view.asp?id=<%=rs("id")%>" title="<%=rs("msg_title")%>" target="_blank">查看</a>/<a href="<%=filename%>?action=webmsg_del&id=<%=rs("id")%>"  title="<%=rs("msg_title")%>" onclick="javascript:{if(confirm('确定要删除短信:<%=rs("msg_title")%> 吗?')){return true;}return false;}">删除</a></td>
  </tr>
  <%
if i>=maxpage then exit do
rs.movenext
loop
%>
</table>
<table width="550" height="40" border="0" align="center" cellpadding="0" cellspacing="0">
  <form name="form1" method="post">
    <tr>
      <td width="421" align="right"><!-- ########### 开始判断分页类型 ############### -->
          <font face="Webdings">7</font>&nbsp;
          <%if currentpage>1 then%>
          <a href="<%=filename%>?sql=<%=request.Querystring("sql")%>&var=<%=request.querystring("var")%>"><%end if%>首页<%if currentpage>1 then%></a><%end if%>
&nbsp;&nbsp;
        <%if currentpage>1 then%>
        <a href="<%=filename%>?page=<%=currentPage-1%>&sql=<%=request.Querystring("sql")%>&var=<%=request.querystring("var")%>"><%end if%>上一页<%if currentpage>1 then%></a>
        <%end if%>
&nbsp;&nbsp;&nbsp;
		<%if cint(currentpage)<totalpage then%>
        <a href="<%=filename%>?page=<%=currentPage+1%>&sql=<%=request.Querystring("sql")%>&var=<%=request.querystring("var")%>"><%end if%>下一页<%if cint(currentpage)<totalpage then%></a>
		<%end if%>
&nbsp;&nbsp;&nbsp;
        <%if cint(currentpage)<totalpage then%>
        <a href="<%=filename%>?page=<%=totalpage%>&sql=<%=request.Querystring("sql")%>&var=<%=request.querystring("var")%>"><%end if%>尾页<%if cint(currentpage)<totalpage then%></a>
        <%end if%>
&nbsp;<font face="Webdings">8</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 共有<span class="font3"><%=totalhow%></span>条记录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共<span class="font3"><%=currentPage%></span>/<span class="font3"><%=totalpage%></span>页</td>
      <td width="129"> 
          <select name="topage" size="1" class="select1" onChange="JavaScript:tourl(document.form1.topage.options[document.form1.topage.selectedIndex].value)">
            <%
for j=1 to totalpage
%>
            <option value="<%=filename%>?page=<%=j%>&sql=<%=request.Querystring("sql")%>&var=<%=request.querystring("var")%>" <%if cint(request.Querystring("page"))=j then%>selected<%end if%>> 第<%=j%>页 </option>
            <%next%>
        </select></td>
  </form>
  <!-- ############################ 判断分页类型结束 ######################## -->
</table>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end sub
%>
</body>
</html>

⌨️ 快捷键说明

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