<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="../admin/checkmaster.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%!String searchcontent;%>
<%
String str2,searchkindstr;
String searchkind = request.getParameter("searchkind");
if(searchkind!=null){
searchcontent = new String(request.getParameter("searchcontent").getBytes("iso-8859-1"));
}
if(searchkind==null){
searchkindstr="";
}
else{
searchkindstr="where "+searchkind+"  like '%"+searchcontent+"%'";
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/xmwuye.css" rel=stylesheet type=text/css>
<title>主题贴管理</title>
</head>
<body leftmargin="0" topmargin="5">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <form name="form1" method="post" action="reply_manage.jsp">
      <tr bgcolor="#d6dff7"> 
        <td height="30" align="right" bgcolor="#d6dff7"><div align="center">贴子搜索： 
          <INPUT TYPE="text" NAME="searchcontent" size=20>
        <select name="searchkind">
            <option value="id" selected>id</option>
            <option value="remenu">内容</option>
            <option value="user_id">昵称</option>
          </select>
        <input type="submit" name="Submit" value=" 搜 索 ">
        </div></td>
      </tr>
    </form>
  </table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%"> 
<%
str2="select * from bbsmenu "+searchkindstr+" order by id desc"; 
//out.print(str2);
//out.close();
ResultSet rs=stmt.executeQuery(str2);

int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage;
int i;

intPageSize = 25;
strPage = request.getParameter("pages");
if(strPage==null){
intPage = 1;
}
else
{
intPage = Integer.parseInt(strPage);
if(intPage<1){ intPage = 1;}
}
rs.last(); 
intRowCount = rs.getRow(); 
intPageCount =(intRowCount+intPageSize-1) / intPageSize;
if(intPage>intPageCount) intPage = intPageCount;
if(intPageCount>0){
rs.absolute((intPage-1) * intPageSize+1); 
i = 0; 
%>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#666666">
        <tr bgcolor="#d6dff7" height=22> 
          <td width="5%" height="20" align="center"><strong>ID号</strong></td>
          <td width="6%" align="center">主题ID</td>
          <td width="8%" align="center">用户</td>
          <td align="center">内容</td>
          <td width="10%" align="center">日期</td>
          <td width="12%" align="center">IP</td>
          <td width="4%" align="center"><strong>图片转正</strong></td>
          <td width="4%" align="center"><strong>状态</strong></td>
          <td width="1%" align="center"><strong>修改</strong></td>
          <td width="3%" align="center"><strong>删除</strong></td>
        </tr>
        <%while(i< intPageSize && !rs.isAfterLast()){ %>
        <tr bgcolor="#FFFFFF"> 
          <td  height=25><div align="center"><%=rs.getString("id")%></div></td>
          <td  height=25><div align="center"><a href="../bbs/checkasp.jsp?id=<%=rs.getString("pid")%>" target="_blank"><%=rs.getString("pid")%></a></div></td>
          <td > <div align="center"><%=rs.getString("user_id")%></div></td>
          <td > <div align="center"><%=rs.getString("remenu")%></div></td>
          <td > <div align="center"><%=rs.getString("date").substring(0,16)%></div></td>
          <td > <div align="center"><%=rs.getString("reip")%></div></td>
          <td ><div align="center"> 
              <%if(rs.getString("bbs_img")!=null){%>
              <%if(rs.getString("bbs_img_display").equals("0")){%>
              <A HREF="repicsign.jsp?id=<%=rs.getString("id")%>&s=1&kind=1"><FONT COLOR="green">未转正</FONT></A> 
              <%}else{%>
              <A HREF="repicsign.jsp?id=<%=rs.getString("id")%>&s=0&kind=1"><FONT COLOR="red">已转正</FONT></A> 
              <%}%>
              <%}%>
            </div></td>
          <td ><div align="center"> 
              <%if(rs.getString("deleted").equals("0")){%>
              <a href="repicsign.jsp?id=<%=rs.getString("id")%>&s=1&kind=2"><font color=red>显</font></a> 
              <%}else{%>
              <a href="repicsign.jsp?id=<%=rs.getString("id")%>&s=0&kind=2">隐</a> 
              <%}%>
            </div></td>
          <td > <p align="center"><a href="../bbs/editpost.jsp?id=<%=rs.getString("pid")%>&postuser=<%=rs.getString("rename")%>&reid=<%=rs.getString("id")%>">修改</a></p></td>
          <td > <p align="center"><a href="info_delete.jsp?id=<%=rs.getString("id")%>&tb=bbsmenu">删除</a></p></td>
        </tr>
        <%
rs.next(); 
i++; 
  } 
  }
rs.close();
%>
      </table>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
    <td width="49%" height="25" class=td005> <div align="left">&nbsp;
        <%out.print("共<font color=red>"+intRowCount+"</font>条回复 <font color=red>"+intPageSize+"</font>/页 共<font color=red>"+intPageCount+"</font>页");%>
        当前第<font color=red><%=intPage%></font>页 </div></td>
      <td width="51%" class=td005> <div align="right">&nbsp;
		  <%if(intPage<=1){%>
		   首页
		  <%}else{%>
          <a href="reply_manage.jsp?pages=1">首页</a>
		  <%}%>
          <%if(intPage>1){%>
          <a href="reply_manage.jsp?pages=<%=intPage-1%>">上一页</a> 
          <%}else{%>
          上一页 
          <%
	                }%>
          <%if(intPage<intPageCount){%>
          <a href="reply_manage.jsp?pages=<%=intPage+1%>">下一页</a> 
          <%}else{%>
          下一页 
          <%}%>
		  <%if(intPageCount<=1||intPage==intPageCount){%>
		  尾页
		  <%}else{%>
          &nbsp;<a href="reply_manage.jsp?pages=<%=intPageCount%>">尾页</a>&nbsp;
		  <%}%>
		  </div></td>
  </tr>
</table>
</td>
  </tr>
</table>
</body>
</html>