📄 book1.asp
字号:
<!--#include file="../include/dbopenbd.asp"-->
<!--#include file="checkadmin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
<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;
}
}
</script>
</head>
<BODY background="../images/admin/back.gif">
<%
allpages=0
page=1
totalrec=0
per_page_num=20
url="book1.asp"
'参数
action=request("action")
'列表显示情况
if action="" then call book_index()
'添加、修改的显示和提交处理开始
id=request("id")
'提交
if action="bookok" then call bookok()
'显示
if action="modify" then call bookmodify()
'多选功能处理开始
ids=replace(request("id"),"'","")
if ids="" then mGoBack "您什么也没有选择,单击“确定”返回上一页!"
'关闭
if action="关闭" then call bookclose()
'打开
if action="打开" then call bookopen()
'删除
if action="删除" then call bookdel()
sub book_index()
%>
<table width="98%" border="1" cellpadding="3" bordercolor="#333333" style="border-collapse: collapse;" style="word-break:break-all">
<tr class=backs><td colspan=6 class=td height=18>留言信息管理 </td></tr>
<form name=Prodlist action=book1.asp method=post><tr>
<td align=center width=8%>选</td>
<td align=center width=12% height=15>姓名</td>
<td align=center width=45%>内容(编辑与回复)</td>
<td align=center width=15%>日期</td>
<td align=center width=10%>状态</td>
<td align=center width=10%>审核</td>
</tr>
<%
pages = per_page_num
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from s_book order by [top] desc,Postdate desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td colspan=6 align=center><BR>暂时没有留言<BR><BR></td></tr>"
else
totalrec = RS.RecordCount
rs.pageSize = pages
allPages = rs.pageCount
page = Request("page")
If not isNumeric(page) then page=1
if isEmpty(page) or int(page) <= 1 then
page = 1
elseif int(page) >= allPages then
page = allPages
end if
rs.AbsolutePage = page
do while not rs.eof and pages>0
content=rs("Comments")
replay=rs("replay")
UserName=rs("UserName")
if rs("top")="0" then
Response.write "<tr><td align=center><input type='checkbox' value='"&rs("ID")&"' name=id>"
else
Response.write "<tr><td align=center><font color=red title='固顶信息不能直接删除,请先解除固顶属性再删除'>TOP</font>"
end if
Response.write "</td><td>"&UserName&"</td><td><a href='book1.asp?action=modify&id="&rs("ID")&"'>"
response.write lleft(server.htmlencode(content),50)
response.write "</a></td><td align=center>"&split(rs("Postdate"))(0)&"</td><td align=center>"
if Isnull(Replay) then
response.write "<font color=red>未回复</font>"
else
response.write "已回复"
end if
response.write "</td><td align=center>"
if rs("Online")="0" then response.write "<font color=red>隐藏</font>" else response.write "公开" end if
response.write "</td></tr>"
pages=pages-1
rs.movenext
loop
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
<tr><td colspan=6>
<input type='checkbox' name=chkall onclick='CheckAll(this.form)'>全选
<input type="submit" name="action" value="关闭" onclick="{if(confirm('确定隐藏这条新闻吗?')){this.document.newslist.submit();return true;}return false;}"> <input type="submit" name="action" value="打开" onclick="{if(confirm('确定要显示这条新闻吗?')){this.document.newslist.submit();return true;}return false;}">
<input type="submit" name="action" value="删除" onclick="{if(confirm('该操作不可恢复!\n\n确定删除选定的新闻?')){this.document.newslist.submit();return true;}return false;}">
</td></tr></form></table>
<%
call listPages()
response.end
end sub
sub listPages()
response.write "<br> 总留言数:"&totalrec& " 每页:"& per_page_num&" 条记录 "
if allpages <= 1 then exit sub
if page = 1 then
response.write " <font color=#878787>首页 上页</font>"
else
response.write " <a href='"&request.ServerVariables("script_name")&"?page=1'>首页</a> "
response.write " <a href='"&request.ServerVariables("script_name")&"?page="&page-1&"'>上页</a> "
end if
if page = allpages then
response.write "<font color=#878787>下页 末页</font>"
else
response.write " <a href='"&request.ServerVariables("script_name")&"?page="&page+1&"'>下页</a> "
response.write " <a href='"&request.ServerVariables("script_name")&"?page="&allpages&"'>末页</a> "
end if
response.write " 第"&page&"/"&allpages&"页"
end sub
sub bookopen()
sql="update s_book set online=1 where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选留言已被打开!"
end sub
sub bookclose()
sql="update s_book set online=0 where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选留言已被关闭!"
end sub
sub bookdel()
sql="delete from s_book where id in ("&ids&")"
conn.execute sql
mGoTo url,"所选留言已被删除,单击“确定”返回留言列表!"
end sub
sub bookok()
if trim(request.form("comments"))="" then mGoBack "出错了,留言内容不能为空!"
Set rs=Server.CreateObject("ADODB.Recordset")
if id="" then
sql = "select * from s_book where 1=2"
rs.open sql,conn,1,3
rs.Addnew
else
sql = "select * from s_book where id="&id
rs.open sql,conn,1,3
end if
rs("UserMail")=request.form("UserMail")
rs("url")=request.form("url")
rs("qq")=request.form("qq")
rs("comments")=request.form("comments")
if request.form("Replay")="" then
rs("Replay")=null
else
rs("Replay")=request.form("Replay")
end if
rs("Online")=request("Online")
rs("top")=request("top")
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
mGoTo url,"操作成功,单击“确定”返回留言列表!"
end sub
sub bookmodify()
if id<>"" then
set rs = server.createobject("adodb.recordset")
sql = "select * from s_book where id="&id
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
Comments=rs("Comments")
replay=rs("Replay")
UserName=rs("UserName")
QQ=rs("QQ")
pic=rs("pic")
face=rs("face")
URL=rs("URL")
UserMail=rs("UserMail")
Postdate=rs("Postdate")
IP=rs("IP")
Online=rs("Online")
top=rs("top")
end if
rs.close
set rs=nothing
end if
%>
<table width="98%" border="1" cellpadding="3" bordercolor="#333333" style="border-collapse: collapse;">
<tr class=backs><td colspan=2 class=td height=18>留言信息管理</td></tr>
<form name="repl" method="post" action='book1.asp?action=bookok&id=<%=id%>'>
<tr><TD align="right" WIDTH=20% height=15>留言人IP地址</TD><td><%=IP%></td></tr>
<tr><TD align="right" >留言日期</TD><td><%=PostDate%></td></tr>
<tr><TD align="right" >留言人姓名</TD><td><%=UserName%></td></tr>
<tr><TD align="right" >邮箱</TD><td><input type=text name=UserMail value="<%=UserMail%>" size=35 maxlength=100></td></tr>
<tr><TD align="right" >网址</TD><td><input type=text name=url value="<%=url%>" size=35 maxlength=100></td></tr>
<tr><TD align="right" >腾讯QQ</TD><td><input type=text name=qq value="<%=qq%>" size=35 maxlength=100></td></tr>
<tr><TD align="right" valign=top>留言内容</TD><td><textarea style="overflow:auto" name="comments" cols="60" rows="8"><%=Comments%></textarea></td></tr>
<tr><TD align="right" valign=top>回复内容</TD><td><textarea style="overflow:auto" name="Replay" cols="60" rows="8"><%=replay%></textarea> </td></tr>
<tr><TD align="right" width=20%>是否固顶</TD><td><input type="radio" name="top" value="1" <%if top="1" then%>checked<%end if%>>
固顶<input type="radio" name="top" value="0" <%if top="0" then%>checked<%end if%>>
普通 </td></tr>
<tr><TD align="right" >是否隐藏</TD><td><input type="radio" name="Online" value="0" <%if Online="0" then%>checked<%end if%>>
隐藏<input type="radio" name="Online" value="1" <%if Online="1" then%>checked<%end if%>>
公开 </td></tr>
<TR><TD align="right" > <INPUT TYPE="hidden" name=send value=ok></TD><TD>
<input type="submit" name="action" value=" 提 交 "></TD></TR>
</form></TABLE>
<%
response.end
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -