<!--#include file="../conn.asp" -->
<%
if session("username")="" then
response.Redirect("merr.asp?action=err")
response.End()
else
username=session("username")
userid=session("userid")
end if
%>
<%
userid=session("userid")
username=session("username")
a=Trim(Request.QueryString("a"))
id=Trim(Request.QueryString("id"))
select case a
case "del"
call del
case "see"
call see
case "hui"
call hui
case else
call show
end select
sub show
set rs=server.CreateObject("adodb.Recordset")
sql2="select * from diaryuser where userid="&userid&""
Rs.Open Sql2,conn,1,1
IF Not Rs.Eof Then
rs.close
sql2="select * from book where userid="&userid&" order by id desc"
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="<%=alltubg%>css.css" rel="stylesheet" type="text/css">
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" style="background-color=transparent">
<table width="284" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="370" width="284" align="right">
      <table border="0" width="278" id="table8" cellspacing="0" cellpadding="0" height="370">
        <tr> 
          <td height="19">　</td>
        </tr>
        <tr> 
          <td height="19">
		  <table width="98%" border="0" cellpadding="0" cellspacing="0"  id="table11">
                          <tr bordercolor="DDE7AB"> 
                            <td width="2"></td>
                            
                <td width="151">
                  <div align="center">留言主题</div>
                </td>
                            
                <td width="79">
                  <div align="center">留言人</div>
                </td>
                            
                <td width="39">
                  <div align="center">操作</div>
                </td>
                          </tr>
                        </table>
                        
		  </td>
        </tr>
        <tr> 
          <td background="diary/linebg2.gif" height="1"><img border="0" src="<%=alltubg%>linebg2.gif" width="4" height="1"></td>
        </tr>
        <tr valign="top"> 
          <td> 
            <table border="0" width="100%" id="table9" cellspacing="0" cellpadding="0">
              <tr> 
                <td> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" id="table10">
                    <tr> 
                      <td align="center" style="font-size: 9pt; font-family: Verdana; color: #000000; letter-spacing: 1pt; word-break: break-all" background="img/bg_line.gif"> 
                        <%
Rs.Open Sql2,conn,3,1
IF Rs.Eof and rs.bof Then
response.Write("<br><font color=FF6600>还没有任何人留言！</font><br><br><br><br><br><br>")
else


rs.pagesize=showdiary
maxpage=rs.pagecount
page=clng(request("page"))


if page="" or page=0 then
   page=1
end if
if page>maxpage then
    page=maxpage
end if

rs.absolutepage = page

do while not rs.eof
%>
                        <table width="98%" border="0" cellpadding="0" cellspacing="0"  id="table11">
                          <tr bordercolor="DDE7AB"> 
                            <td width="2"></td>
                            <td width="151"><font color="#51300C"><a target="showpage" href="mguest.asp?a=see&id=<%=rs("id")%>"> 
                              <font color="#800000"> 
                              <%if  rs("title")="" then 
							  title=rs("name")+"的留言"
							  else
							  title=rs("title")
							  end if
							  %>
                              <%= title %></font></a></font></td>
                            <td width="79"><%= rs("name") %></td>
                            <td width="39"> 
                              <%if rs("re") <>"" then%><a href="mguest.asp?a=hui&id=<%=rs("id")%>" title="尚未回复该留言哦" target="showpage"><font color="red">回</font></a><%else%><a href="mguest.asp?a=hui&id=<%=rs("id")%>" title="该留言已回复，进入可修改" target="showpage"><font color="green">回</font></a><%end if%>&nbsp;<a href="mguest.asp?a=del&id=<%=rs("id")%>" onClick="{if(confirm('您真的要删除此留言吗?此操作不可恢复!')){return true;}return false;}" target="showpage"><font color="#51300C">删</font></a> 
                            </td>
                          </tr>
                        </table>
                        <%
n=n+1
rs.movenext
if n>=rs.pagesize then exit do    
loop
%>
                        <br>
                        <table width="98%" border="0" cellspacing="0" cellpadding="0" id="table13">
                          <tr> 
                            <td> 
                              <p align="right"> 
                                <%
if cstr(page)=1 then
Response.Write("<font color=#808080>首页&nbsp;上页&nbsp;</font>")
else
if page>1 and page=maxpage then%>
                                <a href="mguest.asp?page=1"> <font color="#5690BE">首页</font></a> 
                                <a href="mguest.asp?page=<%=page-1%>"> <font color="#5690BE">上页</font></a> 
                                <%end if%>
                                <% if page<>1 and page<>maxpage then%>
                                <a href="mguest.asp?page=1"> <font color="#5690BE">首页</font></a><a href="mguest.asp?page=<%=page-1%>"> 
                                <font color="#5690BE">上页</font></a> 
                                <%end if
end if


if cstr(page)=cstr(rs.pagecount) then%>
                                <font color="#808080">下页</font> <font color="#808080">尾页</font> 
                                <%else%>
                                <%
			if cstr(page)=1 and cstr(page)<>cstr(rs.pagecount) and cstr(rs.pagecount)<>0 then%>
                                <a href="mguest.asp?page=<%=page+1%>" > <font color="#5690BE">下页</font></a> 
                                <a href="mguest.asp?page=<%=maxpage%>"> <font color="#5690BE">尾页</font></a> 
                                <%end if%>
                                <%
			if cstr(page)<>1 and cstr(page)<>cstr(rs.pagecount) and cstr(rs.pagecount)<>0 then%>
                                <a href="mguest.asp?page=<%=page+1%>" > <font color="#5690BE">下页</font></a> 
                                <a href="mguest.asp?page=<%=maxpage%>"> <font color="#5690BE">尾页</font></a> 
                                <%end if%>
                                <%end if%>
                                <font color="#5690BE"> 页次:<%=page%>/<%=maxpage%>&nbsp; 
                                &nbsp; </font> 
                            </td>
                          </tr>
                        </table>
                        <%
Rs.Close
Set Rs=Nothing
End IF
else%>
                        <table width="98%" border="0" cellspacing="0" cellpadding="0" id="table14">
                          <tr> 
                            <td align="center" style="font-size: 9pt; font-family: Verdana; color: #000000; letter-spacing: 1pt; word-break: break-all">　</td>
                          </tr>
                        </table>
                        <%
end if
%>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
<%
end sub
sub del
sql="select * from book where id="&id
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
username=rs("bookuser")
if session("username")=username then
else
%>
<script language='Javascript'>alert("您无权删除其他用户的信息!");history.back();</script>
<%
response.end
end if

rs.delete
rs.close
conn.close
set conn=nothing
%>
<script language='Javascript'>alert("您已经成功删除此留言!");this.location.href='mguest.asp';</script>
<%
end sub
sub see
set rs=server.CreateObject("adodb.Recordset")
sql2="select * from book where id="&request("ID") 
Rs.Open Sql2,conn,1,1
name=rs("name")
hf=rs("re")
ly=rs("ly")
title=rs("title")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="<%=alltubg%>css.css" rel="stylesheet" type="text/css">
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0"  style="background-color=transparent">
<table width="284" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="370" width="284" align="right">
      <table border="0" width="278" id="table8" cellspacing="0" cellpadding="0" height="370">
        <tr> 
          <td height="19" colspan="3" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr align="center"> 
    <td valign="top" width="6">&nbsp;</td>
    <td valign="top" colspan="2"> 
      <div align="right"><a href="mguest.asp" target="_self"><font color="#51300C">返回留言本</font></a>　</div>
    </td>
  </tr>
  <tr align="center"> 
    <td valign="top" width="6">&nbsp;</td>
    <%if  rs("title")="" then 
							  title=rs("name")+"的留言"
							  end if
							  %>
    <td valign="top" width="152"> 
      <div align="left"><font color="#51300C">题目:<font color="#800000"><%=title%></font></font></div>
    </td>
    <td valign="top" rowspan="4" width="56"><img border="0" src="<%=alltubg%>gface/<%=rs("face")%>.gif" height="70"></td>
  </tr>
  <tr align="center"> 
    <td valign="top" width="6">&nbsp;</td>
    <td valign="top" width="152"> 
      <div align="left"><font color="#51300C">昵称:</font><font color="#51300C"><font color="#800000"><%=name%></font></font> 
        <font color="#51300C"><img src="<%=alltubg%>gface/foot.gif" width="16" height="16"></font> 
      </div>
    </td>
  </tr>
  <tr align="center"> 
    <td valign="top" width="6">&nbsp;</td>
    <td valign="top" width="152"> 
      <div align="left"><font color="#51300C">日期:<font color="#800000"><%=rs("booktime")%></font></font></div>
    </td>
  </tr>
  <tr align="center"> 
    <td valign="top" width="6">&nbsp;</td>
    <td valign="top" width="152"> 
      <div align="left"><font color="#51300C">操作:<a href="mguest.asp?a=hui&id=<%=rs("id")%>" target="showpage" title="<%=hf%>"><font color="#51300C">回复</font></a>&nbsp;<a href="mguest.asp?a=del&id=<%=rs("id")%>" onClick="{if(confirm('您真的要删除此留言吗?此操作不可恢复!')){return true;}return false;}" target="showpage"><font color="#51300C">删除</font></a></font></div>
    </td>
  </tr>
  <tr align="center"> 
    <td valign="top" rowspan="6" width="6">&nbsp;</td>
    <td valign="top" colspan="2" background="<%=alltubg%>linebg2.gif" height="1"></td>
  </tr>
  <tr align="center"> 
    <td valign="top" colspan="2"> 
      <div align="left"><font color="#51300C">留言内容:</font></div>
    </td>
  </tr>
  <tr> 
    <td valign="top" colspan="2" align="left"><font color="#336699"><%=ly%></font></td>
  </tr>
  <tr>
    <td valign="top" colspan="2" align="left"><div align="left"><font color="#51300C">主人回复:</font></div></td>
  </tr>
  <tr>
    <td valign="top" colspan="2" align="left"><%=hf%></td>
  </tr>
</table>

          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
<%
rs.close
end sub
sub hui
set rs=server.CreateObject("adodb.Recordset")
sql2="select * from book where id="&request("ID") 
Rs.Open Sql2,conn,1,1
name=rs("name")
hf=rs("re")
ly=rs("ly")
rs.close

if request("d")="edit" then 
set rsedit=server.createobject("adodb.recordset") 
sqledit="select * from book where id="&request("ID")  
rsedit.open sqledit,conn,1,3 
rsedit("re")=request.form("re") 
rsedit.update 
rsedit.close    
set rsedit=nothing  
response.redirect "mguest.asp" 
end if 
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="<%=alltubg%>css.css" rel="stylesheet" type="text/css">
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0"  style="background-color=transparent">
<table width="284" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="370" width="284" align="right">
      <table border="0" width="278" id="table8" cellspacing="0" cellpadding="0" height="370">
        <tr> 
          <td height="19" colspan="3" valign="top"> 
            <table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr align="center"> 
                <td valign="top">&nbsp;</td>
                <td valign="top">
                  <div align="right"><a href="mguest.asp" target="_self">返回留言本</a></div>
                </td>
              </tr>
              <form method="POST" action="mguest.asp?id=<%=request("ID")%>&a=hui&d=edit" target="_self">
                <tr> 
                  <td width="7%" valign="middle" align="center">回<br>
                    <br>
                    复</td>
                  <td> 
                    <textarea cols="32" name="re" rows="20" wrap="hard" style="border: 1 solid #808080"><%=hf%></textarea>
                  </td>
                </tr>
                <tr align="center"> 
                  <td colspan="2">回复网友<a href=# title="<%=ly%>"><font color=blue><%=name%></font></a>的留言</td>
                </tr>
                <tr> 
                  <td width="100%" colspan="2"> 
                    <p align="center"> 
                      <input type="submit" value="提交" style="width:60;height:18;background-color: #FFFFFF; border: 1 solid #808080" name="submit">
                      &nbsp;&nbsp;&nbsp; 
                      <input type="reset" value="清除" style="width:60;height:18;background-color: #FFFFFF; border: 1 solid #808080" name="reset">
                  </td>
                </tr>
              </form>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
<%
end sub
%>



