<% '################################################################# '# 程序名称:逍遥留言本 V1.0 '# 授权方式:免费软件 '# 作者:逍遥浪子 '# 演示及技术支持:http://www.xybook.com '# 发布时间:2005-4-8 '# 声明:本程序由逍遥浪子独立自主开发,保留所有版权。 '# 各种用途均可免费使用、自由传播,但必须保留程序代码中的版权信息。 '################################################################# %> <% '退出管理,返回留言首页 if request("action")="loginout" then session.abandon Response.Redirect ("index.asp") end if '管理登陆 if request("login")="check" then if request("admin")=admin and md5(request("password"))=password then session("login")="ok" response.write "" else response.write "" response.end end if end if function lleft(content,lef) for le=1 to len(content) if asc(mid(content,le,1))<0 then lef=lef-2 else lef=lef-1 end if if lef<=0 then exit for next lleft=left(content,le) end function %> <%=sitename%>
       
<% if session("login")<>"ok" then %>
用户名
密  码
<% else action=request("action") '管理首页 if action="" then%>
<% 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 top desc, PostDate desc" rs.cursorlocation = 3 rs.pagesize = msg_per_page '每页显示记录数 rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write "" end if if not (rs.eof and rs.bof) then '检测记录集是否为空 totalrec = RS.RecordCount '总记录条数 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") replay=rs("replay") UserName=rs("UserName") if rs("top")="0" then Response.write "" rowcount=rowcount-1 rs.movenext loop end if rs.close conn.close set rs=nothing set conn=nothing %>
姓名 内容(编辑与回复) 日期 状态 审核
暂时没有留言
" else Response.write "
TOP" end if Response.write ""&UserName&"" response.write lleft(server.htmlencode(content),50) response.write ""&rs("Postdate")&"" if Isnull(Replay) then response.write "新留言" else response.write "已回复" end if response.write "" if rs("Online")="0" then response.write "隐藏" else response.write "公开" end if response.write "
全选
<% call listPages() end if if request("action")="删除" then delid=replace(request("id"),"'","") call delfeedback() end if if request("action")="replay" then id=request("id") call detailfeedback() end if if request("action")="setup" then call setup() end if end if %>
<% sub setup() Set rs=Server.CreateObject("ADODB.Recordset") sql="select * from book_setup" rs.open sql,conn,1,3 if request("save")="ok" then if trim(request.form("sitename"))="" or trim(request.form("admin"))="" or trim(request.form("maxlength"))="" or trim(request.form("pages"))="" or trim(request.form("huifucolor"))="" or trim(request.form("huifutishi"))="" or trim(request.form("book_jianju"))="" then response.write "" response.end end if if (not isNumeric(request.form("maxlength"))) or (not isNumeric(request.form("pages"))) or (not isNumeric(request.form("book_jianju"))) then response.write "" response.end end if rs("sitename")=request("sitename") '站点名称 rs("admin")=request("admin") '管理员姓名 if trim(request("password"))<>"" then rs("password")=md5(trim(request("password"))) '密码 rs("view")=request("view") '留言审核 rs("maxlength")=request("maxlength") '留言最大长度 rs("pages")=request("pages") '每页留言数 rs("html")=request("html") '是否屏蔽html rs("mailyes")=request("mailyes") '是否必填邮箱 rs("huifutishi")=trim(request("huifutishi")) '回复提示 rs("huifucolor")=trim(request("huifucolor")) '回复颜色 rs("book_jianju")=request("book_jianju") '表格间距 if request("bad")<>"" then rs("bad")=request("bad") '脏话过滤 rs.update response.write "" response.end else %>
网站名称     " maxlength=20>
管理员姓名     " maxlength=16>
管理员密码     [若不修改密码,请留空]
留言必填Email     checked<%end if%>> 否 checked<%end if%> > [留言时是否必须填写有效E-mail地址]
屏蔽html功能     checked<%end if%>> 否 checked<%end if%> > [是否屏蔽用户留言中的html代码]
留言审核开关     checked<%end if%>> 否 checked<%end if%> > [留言是否需要审核]
留言内容长度     " maxlength=3> [留言内容的最多字符数,例如200]
每页留言条数     " maxlength=2> [推荐10]
留言表格间距     " maxlength=2> [合适的间距可使版面更美观,推荐10]
管理员回复提示     " maxlength=10> [例如:“客服回复”]
管理员回复颜色     " maxlength=10> [可使用英文单词或16进制数,如:red、#CCFF00”]
脏话过滤     " size=50 maxlength=255>
[用/隔开]
<% end if rs.close set rs=nothing end sub sub delfeedback() if delid="" or isnull(delid) then response.write "" response.end else conn.execute("delete from Feedback where ID in ("&delid&")") conn.close set conn=nothing response.write "" response.end end if end sub sub detailfeedback() if id="" then response.write "" response.end end if '修改留言资料 if request("send")="ok" then if trim(request.form("comments"))="" then response.write "" response.end end if set rs=server.createobject("adodb.recordset") sql = " select * from feedback where del=false and ID="&id rs.open sql,conn,1,3 if not (rs.eof and rs.bof) then rs("comments")=request.form("comments") rs("Replay")=replace(request.form("Replay"),vbCRLF,"
") rs("ReplayDate") = Now() rs("Online")=request("Online") rs("top")=request("top") rs.update end if rs.close response.write "" response.end end if '显示详细资料 set rs = server.createobject("adodb.recordset") sql = "select * from feedback where ID="&id rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write "" response.end end if if not (rs.eof and rs.bof) then Comments=replace(rs("Comments"),"
",vbCRLF) if rs("replay")<>"" then replay=replace(rs("Replay"),"
",vbCRLF) else repley="" end if %>
留言者IP地址<%=rs("IP")%>
留言日期<%=rs("PostDate")%>
留言人姓名<%=rs("UserName")%> 
留言邮箱<%=rs("UserMail")%> 
留言网址<%=rs("url")%> 
其它联系方式<%=rs("qq")%> 
内容
回复内容 
是否固顶checked<%end if%>> 固顶checked<%end if%>> 普通
是否隐藏checked<%end if%>> 隐藏checked<%end if%>> 公开
 
<% end if rs.close set rs=nothing end sub '分页 sub listPages() if n <= 1 then exit sub %> 共<%=totalrec%>条留言 <%if currentpage = 1 then%> 首页 前页 <%else%> ?page=1"> 首页 ?page=<%=currentpage-1%>">前页 <%end if%> <%if currentpage = n then%> 下页 末页 <%else%> ?page=<%=currentpage+1%>">下页 ?page=<%=n%>">末页 <%end if%> 第<%=currentpage%>页 共<%=n%>页 <%end sub%>