 <!--#include file="../head.asp"-->
  <!--#include file="../checkrole.asp"-->
 <%
     call checkuser("ly")
	 %>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<br>
<TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
  <TR>
    <TD 
    style="BACKGROUND-POSITION: right 50%; BACKGROUND-IMAGE: url(i../mages/bg1.gif); BACKGROUND-REPEAT: repeat-y; BACKGROUND-COLOR: #ffffff" 
    vAlign=top align=middle>
      
      <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>
        <TBODY>
        <TR>
          <TD width="19%"><IMG height=32 src="../images/myinbox.gif" width=150 
            border=0></TD>
          <TD width="81%" background="../images/info_bg.gif">&nbsp;</TD>
        </TR></TBODY></TABLE>
  <%
    if issession=0 then
	 gsid=Replace_Text(request.Cookies("Yxmemberid"))
	else
	gsid=session("id")
	end if						
mycid=gsid
set rs=server.createobject("adodb.recordset") 
sql="select * from Yx_ykmessage where gsid="&gsid&"  "

rs.open sql,conn,1,1 
if rs.eof or rs.bof then 
response.write " <table border=1 cellpadding=0 cellspacing=2 bordercolor=#DCEDFC align=center width='100%' ><tr><td height=100 align=center><font color=red>对不起，暂时没有受到任何游客留言!</font></td></tr></table> " 
else 

msg_per_page=10  
rs.pagesize=msg_per_page  
if not (rs.eof and rs.bof) then
	totalrec=RS.RecordCount 
	if rs.recordcount mod msg_per_page=0 then 
		n=rs.recordcount\msg_per_page 
	else
		n=rs.recordcount\msg_per_page+1                        
	end if                                                                
	currentpage=request("page") 
	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 
	rowcount=rs.pagesize 
end if

if not isempty(request("selAnnounce")) then
idlist=replace_text(request("selAnnounce"))
if instr(idlist,",")>0 then
idArr=split(idlist)
for i = 0 to ubound(idarr)
id=cint(idarr(i))
call deleteannounce(id)
next
response.Redirect"youkemessages.asp?page="&currentpage&""
else
call deleteannounce(cint(idlist))
response.Redirect"youkemessages.asp?page="&currentpage&""
end if
end if 
 %>
 <TABLE border=0 cellPadding=3 cellSpacing=1 align="center">
  <TBODY>
    <TR> 
      <TD height=10>
<%
response.write"<b>您收到"
sql1="select count(id) from Yx_ykmessage where gsid="&gsid&" and seeflag=0"
set totle=conn.execute(sql1)
totle1=totle(0)
response.write"<font color='#ff0000'> "&totle1&"</font> 条游客的新留言</b>"
totle.close 
set totle=nothing
%></td>
      </TR>
</TBODY>
</TABLE>
<Form name="form1" method="POST" action="" onSubmit="return sureok();">
<TABLE width="100%" border="1" cellpadding="4" cellspacing="0" bordercolor="#111111" bordercolorlight="#D7EBFF" bordercolordark="#D7EBFF" style="border-collapse: collapse">

 <TR height=25 bgcolor="#e8f4ff"> 
      <TD align="center"><font color="#CC3300"><b>状态</b></font></TD>
      <TD align="center" bgcolor="#e8f4ff"><font color="#CC3300"><b>标题</b></font></TD>
       <TD align="center"><font color="#CC3300"><b>时间</b></font></TD>

<TD width="92" align="center"><input type='submit' value='删除'></TD>
</TR>
<%do while not rs.eof and rowcount > 0%>
<TR height="20" bgcolor="#ffffff"> 
<TD width="81" align="center">
<% if rs("seeflag")=1 then %>
        <font color="#666666">已读</font>
          <%else%>
        <font color="#FF0000">未读</font>
          <%end if%>
      </td>
<TD width="351" align="center"><a title="<%=rs("title")%>" href="readykmessage.asp?id=<%=rs("id")%>"><%=rs("title")%></a>　</td>
 <TD width="212" align="center">
<%=rs("datemsg")%></td>


<TD width="92" align="center"><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("ID"))%>'></td>
</TR>
<%
rowcount=rowcount-1
rs.movenext
loop
%>
</TABLE>
<TABLE width="100%" border="1" cellpadding="4" cellspacing="0" bordercolor="#111111" bordercolorlight="#D7EBFF" bordercolordark="#D7EBFF" style="border-collapse: collapse">
<TR height=25 bgcolor="#e8f4ff"> <td><%call listPages()%></td></tr></table>
<BR><BR>
 </form>
<%end if%>
</TABLE>
<%
sub deleteannounce(id)
'dim rs,sql
sql="delete   from [Yx_ykmessage] where gsid="&gsid&" and id="&id&""
conn.execute sql
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub

sub listPages() 
   if not (rs.eof and rs.bof) then
	gopage=currentpage
	totalpage=n
	blockPage=Int((gopage-1)/10)*10+1
	if blockPage = 1 Then
		Response.Write "<span disabled>【←前10页</span>&nbsp;&nbsp;"
	Else
		Response.Write("<span disabled>【</span><a href=youkemessages.asp?page="&blockPage-10&">←前10页</a>&nbsp;&nbsp;")
	End If
   i=1
   Do Until i > 10 or blockPage > n
    If blockPage=int(gopage) Then
		Response.Write("<font color=#FF0000>[<b>"&blockPage&"</b>]</font>")
	Else
		Response.Write("<a href=youkemessages.asp?page="&blockPage&">["&blockPage&"]</a>")
    End If
    blockPage=blockPage+1
    i = i + 1
    Loop
	if blockPage > totalpage Then
		Response.Write "&nbsp;&nbsp;<span disabled>后10页→】"
	Else
		Response.Write("&nbsp;&nbsp;<a href=youkemessages.asp?page="&blockPage&">后10页→</a><span disabled>】")
	End If
		Response.Write("&nbsp;&nbsp;共"&n&"页 每页"&msg_per_page&"条记录 共"&totalrec&"条记录")
end if
end sub
 
rs.close
set rs=nothing
conn.close
set conn=nothing
%>