<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Include/Connect.asp"-->
<%
Username=Checkstr(request.querystring("Username"))
if Username="" then
response.end()
end if
%>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../CSS/Hompy/hompy.css" type=text/css rel=stylesheet>
<title></title>
<script language="JavaScript">
<!--
function trim(str) {
	return str.replace(/(^[\s]*)|([\s]*$)/g, "");
}

function formcheck() {
    if(addmessage.content.value =="" || trim(addmessage.content.value)=="")
	{
	alert("留言不能为空！");
	addmessage.content.focus();
	return false;
	}
}
function formcheck1(frmName) {
    if(frmName.content.value =="" || trim(frmName.content.value) =="")
	{
	alert("回复不能为空！");
	frmName.content.focus();
	return false;
	}
}

function ask(msg) {
	
	if( msg=='' ) {
		msg='真的要这样做吗？';
	}

	if (confirm(msg)) {
		return true;
	} else {
		return false;
	}
}
//-->
</script>
</head>
<body  oncontextmenu="window.event.returnValue=false" onselectstart="return false">
<TABLE cellSpacing=0 cellPadding=0 width=473 border=0>
  <TBODY>
    <tr> 
      <TD height=29 align="center"><table width="97%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="14%" class="orange2_b">留言列表</td>
            <td width="65%" style="PADDING-RIGHT: 10px">&nbsp; </td>
            <td width="21%" align="right">&nbsp;</td>
          </tr>
        </table> </TD>
    </tr>
    <TR> 
      <TD height=108 align="center" valign="top"> 
        <table width="97%" height="105" border="0" cellpadding="0" cellspacing="0">
		<form name="addmessage" action="addmessage.asp?Username=<%=Username%>" method="Post" onSubmit="return formcheck();">
		<INPUT type=hidden value=<%=session("Username")%> name=MUser>
          <tr> 
            <td width="22%" height="76" align="center" style="HEIGHT: 50px;BORDER-TOP: #cecfce 1px solid; BORDER-BOTTOM: #cecfce 1px solid; BACKGROUND-COLOR: #f7f7f7"> 
              <TABLE cellSpacing=1 cellPadding=3 
                        align=center bgColor=#cccccc border=0>
                          <TBODY>
                          <TR>
                                          <TD align=middle bgColor=#ffffff><%
if session("Userpic")="" or session("Userpic")="user_photo.gif" then
response.write "<img src='../Userpic/showimg.gif' width='77' height='60' alt='我的形象！'>"
else
response.write "<img src='../Userpic/"&session("username")&"/"&session("userpic")&"' width='80' height='60' alt='我的形象！'>"
end if
%></TD>
                                      </TR></TBODY></TABLE></td>
              <td width="78%" style="HEIGHT: 50px;BORDER-TOP: #cecfce 1px solid; BORDER-BOTTOM: #cecfce 1px solid; BACKGROUND-COLOR: #f7f7f7">
<%
if session("username")="" then
response.write("<textarea style='WIDTH: 355px; HEIGHT: 60px' name='content' readonly>请登录后留言！</textarea>")
else
response.write("<textarea style='WIDTH: 355px; HEIGHT: 60px' name='content'></textarea>")
end if
%>
			  </td>
          </tr>
          <tr> 
            <td height="25" colspan="2" align="right"><input name="silence" type="checkbox" value="1">
              悄悄话 
<%
if session("username")="" then
response.write("<IMG src='../Images/Hompy/btn_message.gif' width='39' height='18' align='absmiddle'>")
else
response.write("<INPUT Type='image' src='../Images/Hompy/btn_message.gif' width='39' height='18' align='absmiddle'>")
end if
%></td>
          </tr>
		</form>
        </table>
        
      </TD>
    </TR>
    <TR> 
      <TD height=24><div align="center">
<%
username=request.querystring("username")
set rs = server.CreateObject("adodb.recordset")
sql="select * from Show5_ALLMessage where Username='"&username&"' Order By MessageID DESC"
   if not isempty(request("page")) then        
      currentPage=cint(request("page"))        
   else        
      currentPage=1        
   end if
   MaxPerPage=6
rs.open sql,cn,1,1
   totalPut=rs.recordcount
'   rs.move  (currentPage-1)*MaxPerPage
   rs.pagesize=MaxPerPage '得到每页数
   mpage=rs.pagecount     '得到总页数
i=rs.recordcount
if rs.eof or rs.bof then
%>
<table width="97%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td style="HEIGHT: 3px;BORDER-TOP: #cecfce 1px solid; BORDER-BOTTOM: #cecfce 1px dotted; BACKGROUND-COLOR: #f7f7f7"><img src="" width="3" height="3" alt=""></td>
  </tr>
  <tr> 
    <td></td>
  </tr>
  <tr> 
              <td height="108" align="center">暂无留言！</td>
  </tr>
  <tr> 
    <td height="1" style="BORDER-BOTTOM: #cecfce 1px solid;"><img name="" src="" width="1" height="1" alt=""> </td>
  </tr>
</table>
<table width="46%" height="45" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><TABLE width="225" height="26">
                  <TBODY>
                <FORM name=form onSubmit="return false;" method=get target=_self>
                  <TR> 
                    <TD><SELECT name=selsearchType>
                                <option value="wpname">留言者</option>
                              </SELECT> <INPUT  maxLength=35 size=15 name=searchTxt>
                        <img src="../Images/Hompy/search_b.gif" align="absmiddle"></TD>
                  </TR>
                </FORM>
              </TABLE></td>
  </tr>
</table>
<%
response.end()
else
do while not rs.eof or rs.bof
%>
          <table width="97%" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td width="82%" style="PADDING-LEFT: 5px; HEIGHT: 24px;BORDER-TOP: #cecfce 1px solid; BORDER-BOTTOM: #cecfce 1px dotted; BACKGROUND-COLOR: #f7f7f7"> 
                <img src="../Images/Hompy/ico_no.gif" width="13" height="5"> <SPAN style="FONT: 9px verdana; LETTER-SPACING: -1px"> 
                </SPAN><span style="FONT: 9px verdana; LETTER-SPACING: -1px"><%=i%></span>&nbsp;<a class=popmenu href="hompy.asp?username=<%=rs("MUser")%>" target="_blank"><%=rs("MUser")%></a> <img src="../Images/Hompy/icon_guest.gif" width="14" height="11"> 
                <SPAN style="FONT: 9px verdana; COLOR: #7f7f7f; LETTER-SPACING: -1px"><%=rs("Posttime")%></SPAN> </td>
              <td align="center" width="18%" style="HEIGHT: 24px;BORDER-TOP: #cecfce 1px solid; BORDER-BOTTOM: #cecfce 1px dotted; BACKGROUND-COLOR: #f7f7f7"><table width="70" height="22" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="70" align="right">
<%
if session("Username")=Username then
%>
<a class="orange" href="javascript:if(ask('真的要删除吗？')) location.href='messagedel.asp?messageid=<%=rs("MessageID")%>';">删除</a>
<%
end if
%></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="51" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td width="22%" height="74" align="center" valign="top" style="PADDING-TOP: 4px"> 
                      <TABLE cellSpacing=1 cellPadding=3 
                        align=center bgColor=#cccccc border=0>
                          <TBODY>
                          <TR>
                                          <TD align=middle bgColor=#ffffff><%
set rs_userpic = server.CreateObject("adodb.recordset")
sql="select * from Show5_ALLUser where Username='"&rs("Muser")&"'"
rs_userpic.open sql,cn,1,1
if rs_userpic("Userpic")="user_photo.gif" then
response.write "<img src='../Userpic/showimg.gif' width='77' height='60'>"
else
response.write "<img src='../Userpic/"&rs_userpic("Username")&"/"&rs_userpic("Userpic")&"'' width='80' height='60'>"
end if
rs_userpic.close
set rs_userpic=nothing
%></TD>
                                      </TR></TBODY></TABLE></td>
                    <td width="78%" style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 5px; PADDING-BOTTOM: 20px; word-break:break-all"><%=rs("Content")%></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td height="28" colspan="2" style="BACKGROUND-COLOR: #f7f7f7" align="center">
<%
set rs_remessage=server.CreateObject("adodb.recordset")
sql="select * from Show5_ALLReMessage where MessageID="&rs("MessageID")&""
rs_remessage.open sql,cn,1,1
do while not rs_remessage.eof
%>
<A name=<%=rs("MessageID")%>></A><TABLE width="100%" height="24" 
                              border=0 cellPadding=0 cellSpacing=0>
                  <TBODY>
                    <TR> 
                      <TD style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; word-break:break-all"><a class="popmenu" href="#"><%=rs_remessage("Username")%></a>：<%=rs_remessage("Content")%> <SPAN style="FONT: 9px verdana; COLOR: #7f7f7f; LETTER-SPACING: -1px"> 
                        (<%=rs_remessage("Posttime")%>)</SPAN></TD>
                    </TR>
                  </TBODY>
                </TABLE>
<%
rs_remessage.movenext
loop
rs_remessage.close
set rs_remessage=nothing
%>
<%
if session("Username")=Username then
%>
<TABLE width="81%" height="18" border=0 cellPadding=0 cellSpacing=0>
                  <form name="remessage<%=i%>" action="remessage.asp?Username=<%=username%>" method="post" onSubmit="return formcheck1(remessage<%=i%>);">
							<INPUT type=hidden value=<%=rs("MessageID")%> name=messageid>
                            <TBODY>
                              <TR> 
                                
                        <TD width="12%" height=18> 
                          <div align="center">回复：</div></TD>
                                
                        <TD width="72%"><INPUT style="WIDTH: 260px" name="content"></TD>
                                
                        <TD width="16%"><INPUT Type="image" src="../Images/Hompy/btn_remessage.gif" width="39" height="18" align="absmiddle"></TD>
                              </TR>
                            </TBODY>
                          </form>
                        </TABLE>
<%
end if
%>
				</td>
            </tr>
            <tr> 
              <td colspan="2">&nbsp;</td>
            </tr>
          </table>
<%
rs.movenext
i=i-1
loop
end if
rs.close
set rs=nothing
%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" style="FONT-SIZE: 11px">
<%
call page()
sub page()%>
<%                                                                                                                           
    pageno=currentPage
    if isempty(pageno) or cint(pageno)<1 or cint(pageno)>mpage then
        pageno=1
    end if
%> 
<%if cint(pageno)>1 then%><a href=messagelist.asp?username=<%=username%>&page=<%=pageno-1%>><%end if%>
<img src="../Images/Hompy/K_play_middle_pre.gif" border="0" align="absmiddle">&nbsp;</a> <%                    
pp=cint(pageno)-3            
  if pp<1 then            
  pp=1            
  end if            
for pno=pp to mpage            
p=p+1            
if pno=cint(pageno) then%>&nbsp;<strong><font color="#FF0000"><%=pno%></font></strong>&nbsp;<%else%>&nbsp;<a href=messagelist.asp?username=<%=username%>&page=<%=pno%>><u><%=pno%></u></a>&nbsp;<%end if%>                    
<%                    
if p>=7 then exit for            
next%>&nbsp;<%if cint(pageno)< mpage then%><a href=messagelist.asp?username=<%=username%>&page=<%=pageno+1%>><%end if%>
<img src="../Images/Hompy/K_play_middle_next.gif" border="0" align="absmiddle"></a> <a href=messagelist.asp?username=<%=username%>&page=<%=mpage%>>
</a> 
<%  
end sub%>
	</td>
  </tr>
</table>
          <table width="46%" height="45" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><TABLE width="225" height="26">
                  <TBODY>
                <FORM name=form onSubmit="return false;" method=get target=_self>
                  <TR> 
                    <TD><SELECT name=selsearchType>
                                <option value="wpname">留言者</option>
                              </SELECT> <INPUT  maxLength=35 size=15 name=searchTxt> <img src="../Images/Hompy/search_b.gif" align="absmiddle"></TD>
                  </TR>
                </FORM>
              </TABLE></td>
  </tr>
</table>
        </div></TD>
    </TR>
  </TBODY>
</TABLE>
</body>
</html>
