?? admin_feedback.asp
字號:
<!--#include file="../Comm/subconn.asp"-->
<!--#include file="../feedbackconfig.asp" -->
<%
dim cls
if session("admin")="" then
Response.Redirect("admin.asp")
else
if session("flag")<>"0" then
cls = Instr(session("flag"), "feedback")
if cls <= 0 then
%>
<script language="javascript">
if (confirm("您的操作權限不夠,系統拒絕你的訪問,請點確定返回,或者點取消退出重新登錄"))
location.href="admin.asp";
else
location.href="quit.asp";
</script>
<%
end if
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="admin.css" type="text/css">
<title>管理界面</title>
<style type="text/css">
<!--
a:link {color: #FFFFFF;text-decoration: none;}
a:visited {color: #FFFFFF;text-decoration: none;}
a:hover {color: #FFFF99;text-decoration: underline;}
.b{color:#cccc99;font-size:10pt;border:dotted 1px}
--></style>
<script language="JavaScript" type="text/JavaScript">
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;
}
}
function checksend(){
if (javaTrim(document.repl.Replay.value)==""){
alert("您沒有填寫回復內容。");
document.repl.Replay.focus();
document.repl.Replay.value="";
return false;
}
return true;
}
function javaTrim(str) {
for (var i=0; (str.charAt(i)==' ') && i<str.length; i++);
if (i == str.length) return ''; //whole string is space
var newstr = str.substr(i);
for (var i=newstr.length-1; newstr.charAt(i)==' ' && i>=0; i--);
newstr = newstr.substr(0,i+1);
return newstr;
}
</script>
</head>
<body topmargin="0" bgcolor="#336699" text=#ffffff>
<!--#include file="top.asp"-->
<table border="0" cellpadding="2" cellspacing="5" style="border-collapse: collapse" bordercolor="#222222" width="772" height="150" bgcolor="#336699" align="center">
<tr><td width=125 valign="top">
<!--#include file="admin_left.asp"-->
</td><td valign="top" width=647>
<table border="1" cellpadding="2" cellspacing="4" bordercolor="#222222" width="100%" style="border-collapse: collapse">
<tr><td width="100%">當前位置:<a href="admin.asp">網站管理中心</a>--留言管理</td></tr>
<tr><td width="100%">
<%action=request("action")%>
<%
if action="" then
%>
<table border="1" style="border-collapse: collapse;border:dotted 1px" bordercolor="#333333" cellpadding=3 width=100%>
<form name=Prodlist action=admin_feedback.asp method=post><tr bgcolor="#003366">
<td width=30 align=center>姓名</td>
<td width=205 align=center>留言內容</td>
<td width=75 align=center>留言日期</td>
<td width=205 align=center>回復內容</td>
<td width=75 align=center>回復日期</td>
<td width=70 align=center>是否隱藏</td>
<td width=30 align=center>刪除</td>
</tr>
<%
dim rs,msg_per_page
dim sql
msg_per_page = 10 '定義每頁顯示記錄條數
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from Feedback where del=false order by PostDate desc"
rs.cursorlocation = 3 '使用客戶端游標,可以使效率提高
rs.pagesize = msg_per_page '定義分頁記錄集每頁顯示記錄數
rs.open sql,conn,1,1
if err.number<>0 then '錯誤處理
response.write "<br><br><br>數據庫操作失敗:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '檢測記錄集是否為空
totalrec = RS.RecordCount 'totalrec:總記錄條數
if rs.recordcount mod msg_per_page = 0 then '計算總頁數,recordcount:數據的總記錄數
n = rs.recordcount\msg_per_page 'n:總頁數
else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page") 'currentpage:當前頁
If currentpage <> "" then
currentpage = cint(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage 'absolutepage:設置指針指向某頁開頭
rowcount = rs.pagesize 'pagesize:設置每一頁的數據記錄數
dim i
dim k
Do while not rs.eof and rowcount>0
content=rs("Comments")
if content<>"" then content=Autolink(content)
Replay=rs("Replay")
if Replay<>"" then Replay=Autolink(Replay)
UserName=rs("UserName")
if UserName<>"" then UserName=Autolink(UserName)
Response.write "<tr><td class=b>"&UserName&"</td><td class=b valign=top><a href='admin_feedback.asp?action=replay&id="&rs("ID")&"'>"
if len(rs("Comments"))>20 then
response.write left(content,20)&" ..."
else
Response.write content
end if
response.write "</a> </td><td class=b>"&rs("Postdate")&"</td><td class=b valign=top>"
if Isnull(rs("Replay")) then
response.write "<a href='admin_feedback.asp?action=replay&id="&rs("ID")&"'><font color=yellow>馬上回復</font></a> </td><td class=b> </td><td class=b> </td>"
else
if len(rs("Replay"))>20 then
response.write left(Replay,20)&" ..."
else
Response.write Replay
end if
response.write "</td><td class=b>"&rs("ReplayDate")&"</td><td class=b>"
if rs("Online")="0" then response.write "<font color=yellow>隱藏</font>" else response.write "<b>公開</b>" end if
response.write "</td>"
end if
response.write "<td class=b><input type='checkbox' value='"&rs("ID")&"' name=id></td></tr>"
rowcount=rowcount-1
rs.movenext
loop
else
response.write "<tr><td colspan=9 align=center class=b><BR>無滿足條件留言<BR><BR></td></tr>"
end if
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
<tr><td class=b colspan=5></td><td class=b align=right>
<input type="submit" name="action" value="刪除" onclick="{if(confirm('該操作不可恢復!\n\n確實刪除選定的留言?')){this.document.Prodlist.submit();return true;}return false;}">
</td><td><input type='checkbox' name=chkall onclick='CheckAll(this.form)'></td></tr></form></table>
<%
call listPages()
end if
if action="刪除" then
delid=replace(request("id"),"'","")
call delfeedback()
end if
if action="replay" then
id=request("id")
call detailfeedback()
end if
%>
</td></tr></table>
</td></tr>
</table>
</body></html>
<%
sub delfeedback()
if delid="" or isnull(delid) then
Response.write "<BLOCKQUOTE><br><br>操作失敗,沒有選擇合適參數!<A HREF='admin_feedback.asp'><b>點擊返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=admin_feedback.asp""></BLOCKQUOTE>"
else
conn.execute("delete from Feedback where ID in ("&delid&")")
if err.number<>0 then '錯誤處理
response.write "數據庫操作失敗:" & err.description
err.clear
else
conn.close
set conn=nothing
Response.write "<BLOCKQUOTE><br><br>留言刪除成功!<A HREF='admin_feedback.asp'><b>點擊返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=admin_feedback.asp""></BLOCKQUOTE>"
end if
end if
end sub
sub detailfeedback()
if id="" then
response.write "非法留言編號"
response.write "<meta http-equiv=refresh content=""1;URL=admin_feedback.asp"">"
else
'修改留言資料
if request("send")="ok" then
set rs=server.createobject("adodb.recordset")
sql = " select * from feedback where del=false and ID="&id
rs.open sql,conn,1,3
if err.number<>0 then
response.write "數據庫操作失敗:" & err.description '錯誤描述
err.clear
else
if not (rs.eof and rs.bof) then
rs("Replayer")=session("admin")
if request.form("Replay")<>"" then rs("Replay")=request.form("Replay")
rs("ReplayDate") = Now()
rs("Online")=request("Online")
rs.update
end if
end if
rs.close
response.write "留言已經修改、回復"
response.write "<meta http-equiv=refresh content=""1;URL=admin_feedback.asp"">"
response.end
end if
'顯示詳細資料
set rs = server.createobject("adodb.recordset")
sql = "select * from feedback where ID="&id
rs.open sql,conn,1,1
if err.number<>0 then '錯誤處理
response.write "數據庫操作失敗:" & err.description '錯誤描述
err.clear
else
if not (rs.eof and rs.bof) then
Comments=rs("Comments")
Comments=Autolink(Comments)
replay=rs("Replay")
if replay<>"" then replay=Autolink(replay)
%>
<br><TABLE width="95%" border=1 cellpadding=3 style="border-collapse: collapse" bordercolor="#3D5489" align=center>
<form name="repl" method="post" action='admin_feedback.asp?action=replay&id=<%=id%>'><tr><td colspan=2><B><font color="yellow"> 序列ID : <%=rs("ID")%></font></B> </td></tr>
<tr><TD align="right" width=70>留言日期</TD><td>[<%=rs("PostDate")%>]</td></tr>
<tr><TD align="right" width=70>留言人</TD><td><%=rs("UserName")%> </td></tr>
<tr><TD align="right" width=70>郵件</TD><td><%=rs("UserMail")%> </td></tr>
<tr><TD align="right" width=70>留言內容</TD><td><%=Comments%> </td></tr>
<tr><TD align="right" width=70 valign=top height=80>回復</TD><td valign=top><%if isnull(rs("Replay")) then response.write "<b><font color='yellow'>新留言,未回復</font></b>" else response.write replay%></td></tr>
<tr><TD align="right" width=70 valign=top>更新回復</TD><td><textarea name="Replay" cols="60" rows="5"></textarea> </td></tr>
<tr><TD align="right" width=70>是否隱藏</TD><td><input type="radio" name="Online" value="0" <%if rs("Online")="0" then%>checked<%end if%>>
隱藏<input type="radio" name="Online" value="1" <%if rs("Online")="1" then%>checked<%end if%>>
公開 </td></tr>
<TR><TD align="right" width=70> <INPUT TYPE="hidden" name=send value=ok></TD><TD>
<input type="submit" name="action" value="提交回復"> <input type="reset" name="Submit2" value="重置">
</TD></TR>
</form></TABLE>
<%
else
response.write "<BR><BLOCKQUOTE>無此序號留言!<br><br><font color=yellow><B>請檢查!</B></font><BR></BLOCKQUOTE>"
end if
end if
rs.close
set rs=nothing
end if
end sub
sub listPages()
if n <= 1 then exit sub
%>
<p> >>
<%if currentpage = 1 then%>
<font color=darkgray>首頁</font>
<%else%>
<font color=black face="arial"><a href="<%=request.ServerVariables("script_name")%>?page=1">
首頁</font></a>
<a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage-1%>">
<font color=black face="arial" >前頁</a></font>
<%end if%>
<%if currentpage = n then%>
<font color=darkgray face="arial" >后頁</font>
<%else%>
<font color=black face="arial" ><a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage+1%>">下頁</a>
<a href="<%=request.ServerVariables("script_name")%>?page=<%=n%>">末頁</a></font>
<%end if%>
<font color=black face="arial" >
總:<%=currentpage%>/<%=n%>頁 總共:<%=totalrec%>條留言 [<%=msg_per_page%>條/頁]</font></p>
<%end sub%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -