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

📄 user_message.asp

📁 个人博客
💻 ASP
📖 第 1 页 / 共 2 页
字号:
	    	end if
		end if
	end if
	rs.Close
	set rs=Nothing
	call ShowSearch()
end sub

sub showContent()
   	dim i
    i=0
%>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
  <tr>
  <form name="myform" method="Post" action="user_message.asp" onsubmit="return confirm('确定要执行选定的操作吗?');">
     <td>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
          <tr class="title"> 
            <td width="34" align="center"><font color="#FFFFFF">选中</font></td>
            <td width="34" align="center"><font color="#FFFFFF">ID</font></td>
            <td width="138" height="22" align="center"><span class="style1">发表人</span> </td>
            <td width="320" height="22" align="center"><font color="#FFFFFF">留言标题</font></td>
            <td width="154" align="center"><font color="#FFFFFF">发表时间</font></td>
            <td width="87" height="22" align="center"><font color="#FFFFFF"> 
              操作</font></td>
          </tr>
          <%do while not rs.EOF %>
          <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
            <td width="34" align="center"><input name='ID' type='checkbox' onclick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>
            <input name='mainuser' type="hidden" id="mainuser" value='<%=cstr(rs("mainuser"))%>'></td>
            <td width="34" align="center"><%=rs("ID")%></td>
            <td width="138" align="center" <%if userlevel=9 then%>title="IP:<%=rs("addip")%>"<%end if%>><%=rs("message_user")%>
		    </td>
            <td align="center"> <a href=message.asp?name=<%=rs("mainuser")%> target=_blank><%=rs("messagetopic")%>  </a> </td>
            <td align="center"> <%
	if rs("addtime")<>"" then
		response.write rs("addtime")
	else
		response.write "&nbsp;"
	end if
	%> </td>
            <td width="100" align="center"><%
		response.write "<a href='User_message.asp?Action=Modify&ID=" & rs("ID") & "&re=true'>回复</a>&nbsp;"
		response.write "<a href='User_message.asp?Action=Modify&ID=" & rs("ID") & "'>修改</a>&nbsp;"
		response.write "<a href='User_message.asp?Action=Del&ID=" & rs("ID") & "&mainuser="&rs("mainuser")&"' onClick='return confirm(""确定要删除此留言吗?"");'>删除</a>"
		%> </td>
          </tr>
          <%
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext
loop
%>
        </table>  
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页显示的所有留言</td>
            <td> <strong>操作:</strong> 
              <input name="Action" type="radio" value="Del" checked onClick="document.myform.UserLevel.disabled=true">删除&nbsp;&nbsp;&nbsp;&nbsp;
                   <input type="submit" name="Submit" value=" 执 行 "></td>
  </tr>
</table>
</td>
</form></tr></table>
<%
end sub

sub ShowSearch()
%>
<form name="form2" method="post" action="user_message.asp">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="tdbg">
    <td width="120"><strong>留言高级查询:</strong></td>
    <td width="300">
      <select name="Field" id="Field">
        <option value="ID">留言ID</option>
        <option value="topic" selected>留言标题</option>
      </select>
      <input name="Keyword" type="text" id="Keyword" size="20" maxlength="30">
      <input type="submit" name="Submit2" value=" 查 询 ">
      <input name="UserSearch" type="hidden" id="UserSearch" value="10">
	</td>
    <td>若为空,则查询所有留言</td>
  </tr>
</table>
</form>
<%
end sub

sub Modify()
	dim ID
	dim rsblog,sqlblog
	dim restr
	ID=trim(request("ID"))
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足!</li>"
		exit sub
	else
		ID=Clng(ID)
	end if
	Set rsblog=Server.CreateObject("Adodb.RecordSet")
	if userlevel=9 then
		sqlblog="select * from [message] where ID=" & ID
	else
		sqlblog="select * from [message] where ID=" & ID&" and mainuser='"&username&"'"
	end if
	rsblog.Open sqlblog,Conn,1,1
	if rsblog.bof and rsblog.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>找不到指定的留言!</li>"
		rsUser.close
		set rsUser=nothing
		exit sub
	end if
	if request("re")="true" then
		restr="<table align=center bgcolor=#f3f3f3 border=1 bordercolor=#cccccc cellPadding=2 cellSpacing=0 style='BORDER-COLLAPSE: collapse' width='90%'>"
		restr=restr&"<tbody><tr><td><p><strong>以下为blog主人的回复:</strong></p><p>&nbsp;</p></td></tr></tbody></table>"
	end if
%>
<FORM action="user_message.asp?action=SaveModify" method="post" name="form2" onSubmit="return VerifySubmit()">
  <table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr align="center"> 
    <td height=25 colspan=5 class="topbg"><strong>修 改  留 言</strong> 
  <tr> 
    <td width="11%"  class="tdbg" height=23>留言标题:</td>
    <td width="89%" colspan="4" class="tdbg"><input name="topic" type=text class="cont" id="topic" value="<%=rsblog("messagetopic")%>" size="50" maxlength="30"> 
      <font color="#FF0000"> *</font></td>
  </tr>
  <tr> 
    <td height=23 colspan="5" class="tdbg"><INPUT type="hidden" name="edit" id="edit" value="<%
				if rsblog("message")<>"" then
					response.Write Server.HtmlEncode(rsblog("message"))+restr
				else
					response.Write "   "
				end if
				%>""> 
<!--#include file="edit.asp"-->      &nbsp;</td>
  </tr>
  <tr> 
    <td height=25 colspan="5" class="tdbg"> <INPUT type="hidden" name="id" value="<%=rsblog("id")%>">
        <input type="submit" name="Submit2" value="提交修改">
             
        <input type="reset" name="Submit" value="清除重写">     </td>
  </tr>
</table> 
</form>
<%
	rsblog.close
	set rsblog=nothing
end sub




sub SaveModify()
	dim id,rsblogchk
	id=clng(trim(request("id")))
	if CheckUserLogined()=False then
		response.Write "user_login.asp"
	end if
	'call chkenaddlog()
	if userlevel=9 then
		sql="select * from message where id="&id
	else
		sql="select * from message where id="&id&" and mainuser='"&username&"'"
	end if	
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,3
	rs("messagetopic")=trim(request("topic"))
	rs("message")=request("edit")
	rs.update
	rs.close
	set rs=nothing
	call CloseConn()
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""修改留言成功!"");"
	Response.Write"window.location='user_message.asp'"
	Response.Write"</script>"
	'response.redirect "user_message.asp"
end sub


sub Delmessage()
	if ID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定要删除的留言</li>"
		exit sub
	end if
	if instr(ID,",")>0 then
		ID=replace(ID," ","")
		if userlevel=9 then
			sql="delete from [message] where ID  in (" & ID & ")"
		else
			sql="delete from [message] where ID  in (" & ID & ")"&" and mainuser='"&username&"'"
		end if
		dim n,i,u '留言数-1
		n=split(id,",")
		u=split(mainuser,",")
		for i=0 to ubound(n)
			conn.execute("update [user] set messagecount=messagecount-1 where username='"&trim(u(i))&"'")
		next		
	else
		if userlevel=9 then
			sql="delete from [message] where ID=" & Clng(ID)
		else
			sql="delete from [message] where ID=" & Clng(ID)&" and mainuser='"&username&"'"
		end if
		conn.execute("update [user] set messagecount=messagecount-1 where username='"&mainuser&"'")
	end if
	Conn.Execute sql
	call CloseConn()      
	response.redirect ComeUrl
end sub


sub WriteErrMsg()
	dim strErr
	strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
	strErr=strErr & "<link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbcrlf
	strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
	strErr=strErr & "  <tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr>" & vbcrlf
	strErr=strErr & "  <tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因:</b>" & errmsg &"</td></tr>" & vbcrlf
	strErr=strErr & "  <tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a></td></tr>" & vbcrlf
	strErr=strErr & "</table>" & vbcrlf
	strErr=strErr & "</body></html>" & vbcrlf
	response.write strErr
end sub

%>

⌨️ 快捷键说明

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