<?
include_once("../inc/config.php");
include_once("../inc/publicfun.php");
include_once("../inc/ftbbsdbclass.php");
include_once("../inc/ftcode.php");
include_once("../pageclass.php");
include_once("../conn.php");
include_once("check_master.php");

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=adminmakecache('../cache/ftbbsmb.html',$query,$expire);
$pagesize=$ftbbsmb[5];

$searchcontent=$_POST["searchcontent"];
$searchkind=$_POST["searchkind"];
if ($searchcontent==""){
$searchcontent=$_GET["searchcontent"];
$searchkind=$_GET["searchkind"];
}
if ($searchkind==""){
	$sql="select * from {$tablepre}bbsmenu order by id desc";
}
else{
	switch ($searchkind){
		case "id":
			$sql="select * from {$tablepre}bbsmenu where id=".$searchcontent." order by id desc";
			break;
		case "re_name":
			$sql="select * from {$tablepre}bbsmenu where user_id='".$searchcontent."' order by id desc";
			break;
		case "pid":
			$sql="select * from {$tablepre}bbsmenu where pid=".$searchcontent." order by id desc";
			break;
		case "deleted":
			$sql="select * from {$tablepre}bbsmenu where deleted=1 order by id desc";
			break;
		case "ip":
			$sql="select * from {$tablepre}bbsmenu where reip ='".$searchcontent."' order by id desc";
            break;
	}
}

$p = new ft_page;
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);

$p->pvar="page"; 
$p->setvar(array("searchcontent" => $searchcontent, "searchkind" => $searchkind));
$p->set($pagesize,$numrows,$psize); 
$rsx=mysql_query($sql." limit ".$p->limit());
?>
<link href="../css/main01.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<script src="../js/publicfun.js" type="text/javascript"></script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <TR align=center class="f12"> 
    <FORM METHOD=POST ACTION="" >
      <TD width="55%"><div align="left">
      <?
	  $p->output(0);
	  ?>
        </div></TD>
      <TD width="45%" height="28" align="right"> 搜索： 
        <INPUT TYPE="text" NAME="searchcontent" size=20> <select name="searchkind">
          <option value="id">ID号</option>
          <option value="re_name">用户名</option>
          <option value="pid">主题ID</option>
          <option value="ip">IP地址</option>
        </select> <INPUT TYPE="submit" value="搜索" name=""> </TD>
    </FORM>
  </TR>
</TABLE>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
        <td width="100%"> 
         <table border="0" cellspacing="1" width="100%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0" bgcolor="#cccccc">
        <tr bgcolor="#f3f3f3" class="f12"> 
          <td width="4%" height="25" align="center"><strong>选择</strong></td>
          <td width="4%" align="center"><strong>ID号</strong></td>
          <td width="4%" align="center"><strong>主题</strong></td>
          <td width="10%" align="center"><strong>作者</strong></td>
          <td width="30%" align="center"><strong>内容</strong></td>
          <td width="12%" align="center"><strong>IP</strong></td>
          <td width="12%" align="center"><strong>日期</strong></td>
          <td width="5%" align="center"><strong>状态</strong></td>
          <td width="5%" align="center"><strong>删除</strong></td>
        </tr>
          <form name="selectform" method=post action="pldelreply.php">
            <input type="hidden" name="op" value="选择显示">
            <input type="hidden" name="returnURL" value="reply_manage.php?<?=phpself?>">
 <script language="JavaScript">
  function select_pl_submit(optype){
	var f=document.forms["selectform"]
	f.op.value=optype
	f.submit()
  }
 </script>
<?
if ($numrows!=0){
  while ($myrow = mysql_fetch_array($rsx)) {
?>
        <tr bgcolor="#FFFFFF" class="f12"> 
          <td height="25" align="center"><input name="checkbox1[]" type="checkbox" value="<?=$myrow["id"]?>"></td>
          <td height="25" align="center">
            <?=$myrow["id"]?>
          </td>
          <td align="center"> <a href="../ftbbs.php?id=<?=$myrow["pid"]?>" target="_blank"> 
            <?=$myrow["pid"]?>
            </a> </td>
          <td align="center"> 
            <?=$myrow["re_name"]?>
          </td>
          <td align="left"> 
            <?=nohtml($myrow["remenu"])?>
          </td>
          <td align="center"> 
            <?=$myrow["reip"]?>
          </td>
          <td align="center"> 
            <?=$myrow["dateh"]?>
          </td>
          <td align="center"> 
            <? if ($myrow["deleted"]==0){?>
            <A HREF="bzdeltohtm.php?id=<?=$myrow["pid"]?>&reid=<?=$myrow["id"]?>&sign=1"><FONT COLOR="green">显示</FONT></A> 
            <? }else{?>
            <A HREF="bzdeltohtm.php?id=<?=$myrow["pid"]?>&reid=<?=$myrow["id"]?>&sign=0"><FONT COLOR="red">隐藏</FONT></A> 
            <? }?>
          </td>
          <td align="center"> <a href="bzdeltohtm.php?id=<?=$myrow["pid"]?>&reid=<?=$myrow["id"]?>" onclick="return confirm('确实要删除吗？');">删除</a></td>
        </tr>
        <?
}
?>
            <tr bgcolor="#FFFFFF"> 
              <td height="25" colspan="23"> 
			    <input type="checkbox" name="chkall" onclick="checkall(this.form)"> 
                <input name="button" type="button" onclick="select_pl_submit('选择删除')" value="将所选删除" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
              <input name="button2" type="button" onClick="select_pl_submit('选择显示')" value="将所选显示" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>> 
              <input name="button2" type="button" onClick="select_pl_submit('选择隐藏')" value="将所选隐藏" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
            </td>
            </tr>
          </form>
        <tr bgcolor="#FFFFFF"> 
          <td colspan=16 height=25 align="left"> 
            <?
     $p->output(0);
     mysql_free_result($rs);
     mysql_free_result($rsx);
     $db->close(); 
    ?>
          </td>
        </tr>
        <? }else{?>
        <tr bgcolor="#F2F9F9"> 
          <td height="25" colspan=16 align="center" class="f12"> 记录为空!</td>
        </tr>
        <? }?>
      </table>
      </td>
  </tr>
</table>
</body>
</html>