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

📄 user_message.asp

📁 博客程序整站(完整)
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="conn.asp"-->
<!--#include file="user_chkpass.asp"-->
<!--#include file="inc/usercode.asp"-->
<!--#include file="inc/function.asp"-->
<SCRIPT language=javascript>
function del_space(s)
{
	for(i=0;i<s.length;++i)
	{
	 if(s.charAt(i)!=" ")
		break;
	}

	for(j=s.length-1;j>=0;--j)
	{
	 if(s.charAt(j)!=" ")
		break;
	}

	return s.substring(i,++j);
}


function VerifySubmit()
{
	topic = del_space(document.form2.topic.value);
     if (topic.length == 0)
     {
        alert("您忘了填写题目!");
	return false;
     }
		 
	submits(); 
	if (document.form2.edit.value == "")
     {
        alert("请输入内容!");
	return false;
     }	
	return true;
}
</SCRIPT>
<%
if CheckUserLogined()=False then
	response.Redirect "user_login.asp"
end if
const MaxPerPage=20
dim strFileName
dim totalPut,CurrentPage,TotalPages
dim rs, sql
dim ID,UserSearch,Keyword,strField
dim Action,FoundErr,ErrMsg
dim tmpDays,usersql
dim mainuser
keyword=trim(request("keyword"))
if keyword<>"" then 
	keyword=ReplaceBadChar(keyword)
end if
strField=trim(request("Field"))
UserSearch=trim(request("UserSearch"))
Action=trim(request("Action"))
ID=ReplaceBadChar(trim(Request("ID")))
mainuser=ReplaceBadChar(trim(Request("mainuser")))
ComeUrl=Request.ServerVariables("HTTP_REFERER")

if UserSearch="" then
	UserSearch=0
else
	UserSearch=Clng(UserSearch)
end if
strFileName="user_message.asp?UserSearch=" & UserSearch
if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if

%>
<html>
<head>
<title>用户留言管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
function unselectall()
{
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
}
</SCRIPT>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
  <tr class="topbg"> 
    <td height="22" colspan=2 align=center><strong>留 言 板 管 理</strong></td>
  </tr>
  <form name="form1" action="user_message.asp" method="get">
    <tr class="tdbg"> 
      <td width="100" height="30"><strong>快速查找留言:</strong></td>
      <td width="687" height="30"><select size=1 name="UserSearch" onChange="javascript:submit()">
          <option value="0">列出所有留言</option>
       	  <%if userlevel=9 then%><option value="1">我的留言</option><%end if%>
          <option value="10" selected> </option>
         
        </select>
        &nbsp;&nbsp;&nbsp;&nbsp;<a href="user_message.asp">留言管理首页</a>&nbsp;</td>
    </tr>
  </form>
</table>
<br>
<%
if Action="Modify" then
	call Modify()
elseif Action="SaveModify" then
	call SaveModify()
elseif Action="Del" then
	call Delmessage()
else
	call main()
end if
if FoundErr=True then

	call WriteErrMsg()
end if
call CloseConn()  

sub main()
	dim strGuide
	strGuide="<table width='98%' align='center'><tr><td align='left'>您现在的位置:<a href='User_message.asp'>用户留言管理</a>&nbsp;&gt;&gt;&nbsp;"
	select case UserSearch
		case 0
			if userlevel=9 then
				sql="select * from [message] order by ID desc"
			else
				sql="select * from [message] where mainuser='"&username&"' order by ID desc"
			end if
			strGuide=strGuide & "所有留言"
		case 1
			sql="select * from [message] where mainuser='"&username&"' order by id desc"
			strGuide=strGuide & "我文章里的留言"
		
		case 10
			if Keyword="" then
				if userlevel=9 then 
					sql="select * from [message] order by id desc"
				else
					sql="select * from [message] where mainuser='"&username&"' order by id desc"
				end if
				strGuide=strGuide & "所有留言"
			else
				select case strField
				case "ID"
					if IsNumeric(Keyword)=False then
						FoundErr=True
						ErrMsg=ErrMsg & "<br><li>ID必须是整数!</li>"
					else
						if userlevel=9 then 
							sql="select * from [message] where ID =" & Clng(Keyword)&" and mainuser='"&username&"'"
						else
							sql="select * from [message] where ID =" & Clng(Keyword)
						end if
						strGuide=strGuide & "留言ID等于<font color=red> " & Clng(Keyword) & " </font>的用户"
					end if
				case "topic"
					if userlevel=9 then
						sql="select * from [message] where messagetopic like '%" & Keyword & "%' order by ID  desc"
					else
						sql="select * from [message] where messagetopic like '%" & Keyword & "%' and mainuser='"&username&"' order by ID  desc"
					end if
					strGuide=strGuide & "标题中含有“ <font color=red>" & Keyword & "</font> ”的留言"
				end select
			end if
		case else
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>错误的参数!</li>"&sql
	end select
	strGuide=strGuide & "</td><td align='right'>"
	if FoundErr=True then exit sub
	
	Set rs=Server.CreateObject("Adodb.RecordSet")
	'response.Write userlevel
	'response.Write(sql)
	rs.Open sql,Conn,1,1
  	if rs.eof and rs.bof then
		strGuide=strGuide & "共找到 <font color=red>0</font> 个留言</td></tr></table>"
		response.write strGuide
	else
    	totalPut=rs.recordcount
		strGuide=strGuide & "共找到 <font color=red>" & totalPut & "</font> 个留言</td></tr></table>"
		response.write strGuide
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
	    if currentPage=1 then
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,true,"个留言"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,true,"个留言"
        	else
	        	currentPage=1
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,true,"个留言"

⌨️ 快捷键说明

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