<!--#include file="inc_const.asp"-->
<%response.expires=0
Response.CacheControl = "Private"
application.lock

set cschat=server.createobject("ffcschat.cssbchat")
my_level=cschat.getLevel(Session,Application(ConstStr & "_user_list"),Application(ConstStr & "_room_list"))
myname=cschat.myname
set cschat=nothing
application.unlock

guestadmin=false
if my_level=0 then
  login=false
  logstr="(secret=false)"
else
  login=true
  if my_level-application( ConstStr & "_l_delnote")>=0 then
    logstr="(1=1)"
    guestadmin=true
  else
    logstr="(secret=false or who='"&myname&"' or towho='"&myname&"')"
  end if
end if

Set Conn=Server.CreateObject("ADODB.Connection")
conn.open Application( ConstStr & "_connstr")

dim rootRs
Set rootRs=Server.CreateObject("ADODB.RecordSet")
sql="select * from guestbook where "&logstr
findkey=request("findkey")
if findkey<>"" then
  sql=sql&"and (who like '%"&findkey&"%' or towho like '%"&findkey&"%' or text_title like '%"&findkey&"%')"
end if
sql=sql&" ORDER BY ID DESC"
pagesize=cint(Application( ConstStr & "_gbpagesize"))
rootRs.Open sql,conn,1,1
If rootRs.Bof OR rootRs.Eof Then
  response.redirect("showerr.asp?errtext=没有找到有效的留言！")
else%>
<SCRIPT language=JavaScript>function ts(){return(confirm('留言删除后不可恢复，请确认！'))}</script>
<SCRIPT language=JavaScript>function qs(){return(confirm('管理员提款，自己不要动，确定！'))}</script>
<META content="text/html; charset=gb2312" http-equiv=content-type>
<link rel="stylesheet" type="text/css" href="chat.css">
<style TYPE="text/css">td {text-align:left}p {color:000000;margin-left:20;margin-top:0;line-height:150%}</style>
<body bgcolor="EAF2FF" leftmargin=3 topmargin=7>
<table height=100% width=100%><script src="showad.asp?id=3"></script><tr><td align=center valign=center>
<center><br><font style="color:navy;font-size: 30pt;font-family:'华文彩云,方正姚体,黑体'">留言本</font></center>
<center><br><font color=990000><%if not login then%>你尚为登录，所以你不能看到与你有关的私人留言。<%else%>欢迎<font color=224466>〖<%=myname%>〗</font>的到来，以下是与你有关的留言。<%end if%></font><center>
<table align=center width="90%" cellspacing=0 cellpadding=0 border=0>
<form action="guest.asp" method="post">
<%rootRs.pagesize=pagesize
page=Request("page")
if not IsNumeric(page) or page="" then page=1
if (page-1)<0 then
  page=rootRs.pagecount
elseif (page-rootRs.pagecount)>0 then
  page=1
end if
rootRs.AbsolutePage=page
RowCount =rootRs.pagesize%>
<tr><td nowrap><center><font color=0000ff>第<%=page%>页　共<%=rootRs.pagecount%>页</font>　<a href="guest.asp?page=<%=(page-1)%>&findkey=<%=findkey%>">上一页</a>　<a href="guest.asp?page=<%=(page+1)%>&findkey=<%=findkey%>">下一页</a>　<a href="write.asp">写留言</a>　<a href="guest.asp">刷新浏览</a>　
<input type=text name="findkey" size=10 maxlength=20 value='<%=myname%>'>
<input class=navy1 type=submit name="cmdYes" value="查找留言" title="输入字符串然后查寻"></center>
</td></tr></form><tr><td><tr><td><div align="center">留言将按所花费的经验值来排列</div></td></tr>
<script>function a(email,who,i,post_time,towho,addr,exp_num,text_body,secret,text_title,kill,id){
  email="<font color=#cc00cc><a href='mailto:"+email+"'>"+who+"</a>"+i+"&nbsp;于&nbsp;</font>"+post_time+"<font color=#cc00cc>&nbsp;给&nbsp;</font>"+towho+"<font color=#cc00cc>&nbsp;留言&nbsp; &nbsp;&nbsp;&nbsp;消费了</font>"+exp_num+"<font color=#cc00cc>点经验值&nbsp";
  document.write("<br><table align=center width=90% cellspacing=0 cellpadding=0 border=1 BORDERCOLORLIGHT=#000000 BORDERCOLORDARK=#ffffff>");
  document.write("<tr><td class=navy1 nowrap>");
  if (kill=="1") {document.write("<a href='del.asp?id="+id+"' title=删除 onclick='return(ts())'><font color=ff0000>[删除]</font></a>");document.write("<a href='guest_expdel.asp?username="+who+"&exp_num="+exp_num+" ' onclick='return(qs())'><font color=ff0000>[划帐]</font></a>")}
  else {document.write("[标题]");}
  document.write("<a href='write.asp?towho="+who+"&title=re:"+text_title+"' target=write>"+text_title+"</a><tr><td>");if (secret=="1") document.write("[悄悄]");
  document.write(email+"<br><br><p>"+text_body+"</p></table>");}</script>
<%Do While Not rootRs.Eof AND RowCount>0
  if rootRs("secret") then
    secret="1"
  else
    secret=""
  end if
  if myname=rootRs("who") or (rootRs("secret") and myname=rootRs("towho")) or guestadmin then
    kill="1"
  else
    kill=""
  end if
  if rootRs("secret")=0 or myname=rootRs("who") or myname=rootRs("towho") then
    text_body=rootRs("text_body")
  else
    text_body="<font color=990000>他人私人留言你无权观看！</font>"
  end if
  who_str=rootRs("who")
  ip=""
  if guestadmin then
    ip="["&rootRs("ip")&"]"
  end if
  response.write "<script>a('"&rootRs("email")&"','"&who_str&"','"&ip&"','"&rootRs("post_time")&"','"&rootRs("towho")&"','"&rootRs("addr")&"','"&rootRs("exp_num")&"','"&text_body&"','"&secret&"','"&rootRs("text_title")&"','"&kill&"','"&rootRs("id")&"');</script>"
  rootRs.MoveNext
  RowCount=RowCount-1
Loop
If rootRs.pagecount>1 then%>
  <tr><td style="text-align:center"><b>分页：</b>
  <%For i=1 to rootRs.pagecount
    if (i-page)<>0 then%><a href='guest.asp?page=<%=i%>&findkey=<%=findkey%>'>[<%=i%>] </a>
    <%else%>(<%=i%>)
    <%end if
  Next
end if
end if
rootRs.close
Set rootRs=nothing
conn.close
Set conn=nothing%></table></body></html>
















