<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%
call ling()
call head
dim p
p=cint(request.QueryString("p"))
if p="" or p<1 then p=1
Call saycardd("网友留言")
'-------A登录信息
if myid=0 then
Response.write "<a href='login.asp?saytk="&saytk&"'>请您先登陆...</a>"& chr(13)
Response.write "<br/><a href='index.asp?saytk="&saytk&"'>返回</a>"& chr(13)
  call head3()
  Response.end
else

'检查有几条新留言
dim newguest
newguest = 0
IF myid > 0 THEN
  newguest = ForNewGuest(myid)
END IF
if newguest > 0 then
Response.write "<a href='bbs/msgview.asp?sid="&sid&"&amp;saytk="&saytk&"'>您有"&newguest&"条新消息</a><br/>"& chr(13)
end if
end if
'---------------------------
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from [gbook] WHERE uid="&myid&" order by [ID] desc",conn,1,1
If Not rs.eof	Then
	Dim PageSize,i
	PageSize=10					
	Dim Count,page,pagecount,gopage,parent			
	gopage="guestmy.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;"
	Count=rs.recordcount
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize	
        if page>pagecount then page=pagecount	
	rs.move(pagesize*(page-1))
        response.write ("共:"&count&"条留言<br/>")
        response.write ("<a href=""guestadd.asp?sid="&sid&"&amp;saytk="&saytk&""">发表留言</a><br/>")				
	For i=1 To PageSize       						
	If rs.eof Then Exit For
response.write "<a href='guestview.asp?ID="&rs("ID")&"&amp;p="&p&"&amp;TP=1&amp;sid="&sid&"&amp;saytk="&saytk&"'>"
response.write ""&i+(page-1)*PageSize&"."&UBB(rs("title"))&"</a><br/>"
response.write "[作者:"&rs("name")
if rs("retext")<>"" then 
response.write "/已回"
else
response.write "/未回"
end if
response.write "]<br/>"
rs.moveNext							
	Next
if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下页</a>"
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上页</a>"
	if pagecount>1 then response.write "<br/><b>"&page&"</b>/"&pagecount&"页"
if saytk=1 then
response.write "<input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""3""/><a href="""&gopage&"page=$(page)"">[GO]</a>"
end if
Else
response.write "还没有留言！<br/>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "<br/><a href=""guestadd.asp?sid="&sid&"&amp;saytk="&saytk&""">发表留言</a>"
response.write "<br/><a href=""guestbook.asp?sid="&sid&"&amp;saytk="&saytk&""">留言列表</a>"
response.write "<br/><a href=""index.asp?sid="&sid&"&amp;saytk="&saytk&""">返回首页</a>"
call headsay()
%>