📄 admin_book.asp
字号:
<!--#include file="conn.asp"-->
<%
if session("admin_name")="" then
response.redirect "default.asp"
end if
admintop()
Select Case Request("action")
Case "savereply" : savereply()
Case "savenotice" : savenotice()
Case "reply" : reply()
Case "notice" : booknotice()
Case "del" : del()
Case Else
list()
End Select
sub del
Dim admin_flag
admin_flag=",25,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
id=request("id")
if id="" then
response.write"<script language='javascript'>alert('请选择您要删除的条目!');javascript:history.go(-1)</script>"
response.end
end if
conn.execute "delete from [guestbook] where id in ("&id&") "
url="?page=" & request("page")
response.redirect url
end if
end sub
sub savereply
Dim admin_flag
admin_flag=",25,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
conn.execute "update [guestbook] set reply='"&Safereplace(request("reply"))&"',show=1 where id="&request("id")
response.redirect "Admin_book.asp"
end if
end sub
sub savenotice
Dim admin_flag
admin_flag=",26,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
conn.execute"update [notice] set notice='"&Safereplace(request("notice"))&"'"
Response.Write "<script language='javascript'>alert('数据更新成功!');location.href='Admin_book.asp'</script>"
end if
end sub
%>
<%sub list
Dim admin_flag
admin_flag=",25,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
%>
<table border="0" cellspacing="1" cellpadding="0" height="0" align=center width="98%" bgcolor="#183789">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="2" width="100%" align="center" bgcolor="#FFFFFF">
<tr>
<td height="27" align="center" class=classtop colspan="6">留言本管理</td>
</tr>
<%
page=clng(request("page"))
set rs=server.createobject("adodb.recordset")
sql="select * from [guestbook] order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Response.Write("<tr class=classtd>")
Response.Write("<td colspan=""6"" height=""50"" align=""center"" >没有站内留言</td>")
Response.Write("</tr>")
else
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=10
rs.AbsolutePage=pagecount
do while not rs.eof
%>
<form name=form action="?action=del&page=<%=cstr(pagecount)%>" method=post>
<tr class=classtd>
<td height="25" width="5%"><input name="id" type="checkbox" value="<%=rs("id")%>"></td>
<td height="25" width="20%"> 呢称:<%=rs("name")%></td>
<td height="25" width="15%"> QQ:<%=rs("qq")%></td>
<td height="25" width="25%"><a href="mailto:<%=rs("email")%>" title="Email:<%=rs("email")%>" target="_blank"> Email:<%=rs("email")%></a></td>
<td height="25" width="15%" align="center"><img src="../images/ip.gif" border="0"> <%=rs("ip")%></td>
<td height="25" width="10%" align="center">[<a href="?action=reply&id=<%=rs("id")%>">回复</a>]</td>
</tr>
<tr>
<td height="20" width="5%">标题:</td>
<td height="20" colspan="3"><img src="../images/icons/<%=rs("face")%>.gif" width="17"> <%=rs("title")%>
</td>
<td colspan="2" align="center"><font color="#666666">TIME:<%=rs("time")%></font></td>
</tr>
<tr>
<td height="30" width="5%">内容:</td>
<td height="30" colspan="5"><%if rs("isadmin")=1 then response.write"[<font color=red>悄悄话</font>]" end if%><%=rs("content")%></td>
</tr>
<%if rs("reply")<>"" then%>
<tr>
<td height="30" width="5%"><font color=red>回复:</font></td>
<td height="30" colspan="5"><%=rs("reply")%></td>
</tr>
<%
end if
rs.movenext
i=i+1
if i>=rs.pagesize then exit do
loop
%>
</table>
<table border="0" cellspacing="1" cellpadding="2" width="100%" align="center" bgcolor="#FFFFFF">
<tr class="classfooter">
<td width="20%" height="30" align="center"> <input type="submit" name="Submit" value="删除" onClick="return confirm('您确定要这样操作吗?')" class="button">
<input type=button value="全部选定" onClick="this.value=check(this.form.id)" class="button"></td></form>
<form action="Admin_book.asp" method="post">
<td height="25">
<div align="center"> 共 <b><%=rs.recordcount%></b> 条留言, 页次: <b><font color=red><%=pagecount%></font>/<%=rs.pagecount%></b>,
当前从第
<%
if pagecount<=1 then
response.write "<font color=red>1</font>"
else
response.write "<font color=red>" & pagecount*rs.pagesize-rs.pagesize+1 & "</font>"
end if
%>
条开始。
<% if pagecount=1 and rs.pagecount<>pagecount and rs.pagecount<>0 then%>
<a href="?page=<%=cstr(pagecount+1)%>">下一页</a>
<% end if %>
<% if rs.pagecount>1 and rs.pagecount=pagecount then %>
<a href="?page=<%=cstr(pagecount-1)%>">上一页</a>
<%end if%>
<% if pagecount<>1 and rs.pagecount<>pagecount then%>
<a href="?page=<%=cstr(pagecount-1)%>">上一页</a> <a href="?page=<%=cstr(pagecount+1)%>">下一页</a>
<% end if%>
直接到第
<select name="page">
<%for i=1 to rs.pagecount%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>页
<input type="submit" name="go" value="跳转" class="button">
</div>
</td>
</form>
</tr>
</table>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
end if
end if
end sub
%>
<%
sub reply
Dim admin_flag
admin_flag=",25,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
set rs=server.createobject("adodb.recordset")
sql="select * from guestbook where id="&request("id")
rs.open sql,conn,1,3
%>
<SCRIPT language=JavaScript>
function CheckInput(){
if(form.reply.value==''){
alert("内容不能为空!");
form.reply.focus();
return false;
}
if(form.reply.value.length>255){
alert("内容不能超过255个字符!");
form.reply.focus();
return false;
}
return true;
}
</SCRIPT>
<table border="0" cellspacing="1" cellpadding="0" height="0" align=center width="98%" bgcolor="#183789">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="2" width="100%" align="center" bgcolor="#FFFFFF">
<tr>
<td height="27" class=classtop colspan="2" align="center">回复 <strong><%=rs("name")%></strong> 的留言</td>
</tr>
<form action="?action=savereply&id=<%=request("id")%>" method="post" name="form" onsubmit=return(CheckInput())>
<tr>
<td width="30%" valign="top" align="left" class=classtd>留言内容:<br><%=rs("content")%></td>
<td width="70%" class=classtd> <textarea name="reply" cols="45" rows="8" class="1" id="reply"><%=rs("reply")%></textarea>
</td>
</tr>
<tr>
<td height="30" colspan="2" align="center" class="classfooter">
<input type="submit" name="button" value="回复留言" class="button">
<input type="reset" name="Submit2" value="清除重写" class="button">
<input type="button" name="Submit2" value="返回" onClick="location.href='Admin_book.asp'" class="button">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<%
rs.close
set rs=nothing
end if
end sub
sub booknotice
Dim admin_flag
admin_flag=",26,"
if session("admin_name")="" or instr(","&session("flag")&",",admin_flag)=0 then
adminflag()
else
set rs=server.createobject("adodb.recordset")
sql="select * from notice"
rs.open sql,conn,1,3
notice=rs("notice")
rs.close
set rs=nothing
%>
<SCRIPT language=JavaScript>
function CheckInput(){
if(form.notice.value==''){
alert("内容不能为空!");
form.notice.focus();
return false;
}
if(form.notice.value.length>255){
alert("内容不能超过255个字符!");
form.notice.focus();
return false;
}
return true;
}
</SCRIPT>
<table border="0" cellspacing="1" cellpadding="0" height="0" align=center width="98%" bgcolor="#183789">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="2" width="100%" align="center" bgcolor="#FFFFFF">
<tr>
<td height="27" class=classtop colspan="2" align="center">留言本公告设置</td>
</tr>
<form action="?action=savenotice" method="post" name="form" onsubmit=return(CheckInput())>
<tr>
<td width="90%" align="center" class=classtd> <textarea name="notice" cols="48" rows="8" class="1" id="notice"><%=notice%></textarea>
</td>
</tr>
<tr>
<td height="30" colspan="2" align="center" class="classfooter"> <input type="submit" value=" 提交 " name="button" class="button">
<input name="Submit2" type="reset" id="Submit2" value=" 重写 " class="button">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<%
end if
end sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -