<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/ubbcode.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/Conn_User.asp"-->

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>留言</title>


<style type="text/css">
BODY {
	scrollbar-face-color:#DDDDDD;
	scrollbar-highlight-color: #cccccc;
	scrollbar-shadow-color: #CCCCCC;
	scrollbar-3dlight-color: #F5F5F5;
	scrollbar-darkshadow-color: #F5F5F5;
	scrollbar-track-color: #F0F0F0;
	scrollbar-arrow-color: #FFFFFF;
	margin-left: 10px;
	margin-top: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
}
</style>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll"&&e.disabled==false)
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}

</SCRIPT>
<link href="new/css.CSS" rel="stylesheet" type="text/css" />
</head>

<body>
<%
myPagesize=10
userid=request("userid")
set rs=server.createobject("adodb.recordset")
rs.open "select * from usercomment where GuserID="&userid &" order by CommentID desc",conn,1,1
call myPages(rs,myPagesize)
%>
<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20" valign="top"><div align="right">
      <%userid=request("userid")%><a href="User_gbooks.asp?gUserID=<%=userid%>" target="_self"><img src=user/gbook.gif border="0"></a></div></td>
  </tr>
</table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1" height="1"></td>
        <td height="1" bgcolor="#BCBCBC"></td>
        <td width="1" height="1"></td>
      </tr>
      <tr>
        <td bgcolor="#BCBCBC"></td>
        <td height="27" align="center" bgcolor="ffffff"><strong>---&nbsp;我的留言&nbsp;</strong>---</td>
        <td bgcolor="#BCBCBC"></td>
      </tr>
    </table>
    <table width="100%" cellpadding="5" cellspacing="1" bgcolor="bcbcbc">
	<%if rs.recordcount=0 then%><tr><Td align=center bgcolor=ffffff><table width='100%' border='0' cellspacing='0' cellpadding='4' bgcolor=ffffff>
      <Tr>
        <td width=40 valign=top align=right><img src=isky/boy1.gif></td>
        <td><table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
            <tr>
              <td width='12'height='60' valign='top' background='isky/left1.gif'><img src='isky/left.gif' width='17' height='60'></td>
              <td rowspan='3' class='td2'><table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor=ffffff>
                  <Tr>
                    <td height=10></td>
                  </tr>
                </table>暂时没有留言
                  <table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor=ffffff>
                    <Tr>
                      <td height=10></td>
                    </tr>
                </table></td>
              <td width=10 valign=top background='isky/right1.gif'><img src='isky/right.gif' width='15' height='60'></td>
            </tr>
            <tr>
              <td background='isky/left1.gif'></td>
              <td width='10' background='isky/right1.gif'></td>
            </tr>
            <tr>
              <td width='17' height='4' valign='bottom' background='isky/left1.gif'><img src='isky/left2.gif' width='17' height='4'></td>
              <td width='10' valign='bottom' background='isky/right1.gif'><img src='isky/right2.gif' width='15' height='4'></td>
            </tr>
        </table></td>
      </tr>
    </table></Td></tr></table><%else%>
 <%line=myPagesize
do while not rs.eof and line>0
%>
<tr><td bgcolor="#f6f6f6">
  <table width="100%" cellpadding="0" cellspacing="0">
  
    <tr><Td width="14" align="center"><img src=user/head.gif></td>
    <Td width="300">
	<%
set userrs=server.createobject("adodb.recordset")
sql="select * from [user] where UserName='"&rs("username")&"' order by userid desc"
userrs.open sql,Conn_User,1,1

%>
<%if rs("usertype")=1 then%>
  
  会员：【<b><a href=user.asp?userid=<%=userrs("userid")%>&mdid=indexd&htm=indexs.asp?userid=<%=userrs("userid")%> target=_blank><%=rs("username")%></a></b>】
  <% else %>
  游客：【<B><span title="姓名：<%= rs("UserName")&vbcrlf%>信箱：<%=  rs("Email")&vbcrlf%>OICQ：<%=  rs("oicq")&vbcrlf%>主页：<%=rs("homepage")%>"  style=cursor:hand><%=rs("username")%></span></b>】
  <%end if%>
   </td>
      <Td width="70" align="center">

	  <%
	  userid=request("userid")
	
	  if CheckUserLogined()=true then
	  UserNamed=Request.Cookies("asp163")("UserName")
	 
	 set userq=server.createobject("adodb.recordset")
sql="select * from [user] where UserName='"&UserNamed&"' order by userid desc"
userq.open sql,Conn_User,1,1

	  
	  userw=userq("userid")
	 
	  If cint(userw)=cint(userid) then
	  
	  %>
	  <a href="usergbookdel.asp?CommentID=<%=rs("CommentID")%>&userid=<%=userq("userid")%>" onClick="return ConfirmDel();"><img src=user/del.gif border="0"></a>&nbsp;<a href="usergbookh.asp?CommentID=<%=rs("CommentID")%>&userid=<%=userq("userid")%>"><img src=user/re.gif border="0"></a>
	   <%else
	  end if%>
	   <%
	  else
	  end if
	  %>	  </td>
      <Td width=80 align="right"><img src="user/time.gif" width="13" height="10"><font style='FONT-SIZE: 11px' color='#666666'><%=year(rs("WriteTime"))%>-<%=month(rs("WriteTime"))%>-<%=day(rs("WriteTime"))%></font></td></tr></table></Td></tr><Tr>
  <td colspan="3" bgcolor="ffffff">
  
<table width='100%' border='0' cellspacing='0' cellpadding='4' bgcolor=ffffff>
  <Tr>
    <td width=40 valign=top align=right><%if userrs("sex")="1" then %><img src=isky/boy1.gif>
      <%else%><img src=isky/girl1.gif><%end if%></td>
    <td><table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
      <tr>
        <td width='12'height='60' valign='top' background='isky/left1.gif'><img src='isky/left.gif' width='17' height='60'></td>
        <td rowspan='3' class='td2'><table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor=ffffff>
          <Tr>
            <td height=10></td>
          </tr>
        </table>
          <%=ubbcode(dvHTMLEncode(rs("Content")))%>
          <%if rs("ReplyContent")<>"" then%>
		   <table width="100%" height="10"  border="0" cellpadding="0" cellspacing="0">
             <tr>
               <td></td>
             </tr>
           </table>
		   <table width='100%' border='0' cellpadding='0' cellspacing='0' background="user/line1.gif">
            <Tr>
              <td height=1></td>
            </tr>
          </table> <table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor=ffffff>
            <Tr>
              <td height=8></td>
            </tr>
          </table>
		  回复：<%=rs("ReplyContent")%>
		  <%else
		  end if%>
		   <table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor=ffffff>
            <Tr>
              <td height=10></td>
            </tr>
          </table>
		  </td>
        <td width=10 valign=top background='isky/right1.gif'><img src='isky/right.gif' width='15' height='60'></td>
      </tr>
      <tr>
        <td background='isky/left1.gif'></td>
        <td width='10' background='isky/right1.gif'></td>
      </tr>
      <tr>
        <td width='17' height='4' valign='bottom' background='isky/left1.gif'><img src='isky/left2.gif' width='17' height='4'></td>
        <td width='10' valign='bottom' background='isky/right1.gif'><img src='isky/right2.gif' width='15' height='4'></td>
      </tr>
    </table></td>
  </tr>
</table>
</td>
  </Tr>
  <%
  userrs.close
set userrs=nothing%>
 <%rs.movenext
   line=line-1
loop
  %>
</table>
 <%end if%>   
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td bgcolor="#BCBCBC"></td>
        <td height="25" align="center" bgcolor="f6f6f6"><table width="100%" height="2"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td></td>
          </tr>
        </table>
<%call listpages(mycondition)%></td>
        <td bgcolor="#BCBCBC"></td>
      </tr>
      <tr>
        <td width="1" height="1"></td>
        <td height="1" bgcolor="#BCBCBC"></td>
        <td width="1" height="1"></td>
      </tr>
    </table>
<%

rs.close
set rs=nothing%>

<%sub listpages(mycondition)
	response.write "<table height=22  border=0 cellpadding=0 cellspacing=0><Tr><td><table width='100%' border=0 cellspacing=0 cellpadding=0><tr><td height=3></td></tr></table>"
	if pages<1 then
		exit sub
	end if
	
	
	if p>0 then
		response.write	"<a href="&request.ServerVariables("script_name")&"?userid="&userid&"&currentpage=10&p="&p-1&mycondition&"><img src=user/prepre.gif alt=前十页 border=0></a>&nbsp;&nbsp;&nbsp;"
    else
	response.write	"<img src=user/prepre.gif alt=前十页 border=0>&nbsp;&nbsp;&nbsp;"
    end if
	'-------------------下面写出当前十个页码
	response.write "</td><td><img src=user/lined.gif border=0><img src=user/k.gif border=0 width=5>"
	for i=1 to 10
		if (p*10+i)>pages then exit for
		if currentpage=i then
		
			response.write "<b><a style='color:ff6600'"
		else
			response.write "<a"
		end if 
		response.write " href="&request.ServerVariables("script_name")&"?userid="&userid&"&currentpage="&i&"&p="&p&mycondition&"><font class=no >"&(p*10+i)&"</font></a></b>&nbsp;&nbsp;<img src=user/lined.gif border=0><img src=user/k.gif width=5 border=0>"	
     next
	 response.write "</td><td><table width='100%' border=0 cellspacing=0 cellpadding=0><tr><td height=3></td></tr></table>"
	 '--------------------察看下十页的连接
    if (p*10+10)<pages then
		response.write "<img src=user/k.gif border=0><a href="&request.ServerVariables("script_name")&"?userid="&userid&"&currentpage=1&p="&p+1&mycondition&"><img src=user/nextnext.gif alt=后十页 border=0></a>&nbsp;&nbsp;" 
		else
		response.write "<img src=user/k.gif border=0><img src=user/nextnext.gif alt=后十页 border=0>&nbsp;&nbsp;"
	end if
	'-----------------------------------------------上下页导航
	response.write "&nbsp;</td>"
	

	  response.write "</tr></table>"
end sub

sub myPages(myRS,mysize)  '------mysize为内部变量（主页面没有定义），myRS为主页面传递过来的RS对象（地址传递）
	if myRS.eof and myRS.bof then str="没有纪录"
	if str="" then
		if mysize="" or NOT IsNumeric(mysize) then
			mysize=15
		end if
		myRS.PageSize=mysize
		pages=myRS.pagecount
		records=myRS.recordcount
		On Error Resume Next '取得数字
		currentPage=request("currentPage")
		if currentPage="" then
			currentPage=1
		end if
		currentPage=CInt(currentPage)
		if Err.Number <> 0 Then
			currentPage=1
			Err.Clear
		end if
		if currentPage<1 then
			currentPage=1
		elseIf currentPage>10 then
			currentPage=10
		end if
		'----------------处理p
		p=request("p")
		if p="" then
			p=0
		end if
		p=CLng(p)
		if Err.Number <> 0 Then
			p=0
			Err.Clear
		end if
		if p<0 then
			p=0
		end if
		'--判断是否出了页数范围
		nowPage=p*10+currentPage
		if nowPage>pages then
			p=(pages-1)\10
			currentPage=((pages-1) mod 10)+1
		end if
		myRS.absolutepage=p*10+currentPage
	else
	   currentPage=1
	   records=0
	   pages=1
	end if
end sub

dim pages,records,currentPage,p '--------定义变量，这些变量在主页面中，进行地址传递%>
</body>
</html>
