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

$admin_user=$_SESSION['admin_user'];
$qs=$_SESSION['qs'];

$searchcontent=trim($_POST["searchcontent"]);
if ($searchcontent!=""){
$str="select * from {$tablepre}ftbbs_admin where admin_user like '%".$searchcontent."%' order by id desc";
}
else{
  if ($qs==2){
     $str="select * from {$tablepre}ftbbs_admin order by id desc";
	 }
  else{
     $str="select * from {$tablepre}ftbbs_admin where admin_user='".$admin_user."' order by id desc";  
  }
}

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

$p->pvar="page"; 
$p->set(30,$numrows,$psize); 
$rsx=mysql_query($str." limit ".$p->limit());
?>
<html>
<head>
<title>飞天论坛</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<link href="../css/main01.css" rel="stylesheet" type="text/css">

</head>

<body bgcolor="#FFFFFF" text="#000000">
<br>
<table width="98%" border="0" align="center">
  <TR align=center>
<FORM METHOD=POST ACTION="<?=PHPSELF?>" >
	  <TD> 
        <INPUT TYPE="text" NAME="searchcontent" size=20>
        <INPUT TYPE="submit" value="搜索" name="" <? if (false===strrpos($_SESSION["admin_qs"],"3")){?>disabled<? }?>>
        <a href="addadmin.php" class="f14">添加管理员</a></TD>
</FORM>
</TR>
</TABLE>
<table width="98%" border="0" bgcolor="#f2f2f2" cellspacing="1" cellpadding="0" align="center">
  <tr align=center bgcolor="#f3f3f3" class="f12"> 
    <td width="6%" height="23">编号</td>
    <td width="17%">用户名</td>
    <td width="20%">密码</td>
    <td width="26%">最后登录时间</td>
    <td width="12%">身份</td>
    <td width="12%">修改</td>
    <td width="7%">删除</td>
  </tr>
<?
if ($numrows!=0){
  while ($myrow = mysql_fetch_array($rsx)) {
     $i++;
     $id=$myrow["id"];
	 $admin_user=$myrow["admin_user"];
	 $admin_pwd=$myrow["admin_pwd"];
	 $qs=$myrow["qs"];
	 $lasttime=$myrow["lasttime"];
?>
  <tr align=center bgcolor="#FFFFFF" class="f12"> 
    <td height="23"> 
      <?=$i?>
    </td>
    <td> 
      <?=$admin_user?>
    </td>
    <td> 
      <?=$admin_pwd?>
    </td>
    <td> 
      <?=$lasttime?>
    </td>
    <td> 
      <? if ($qs==1){
         echo "普通管理员";
	     }
         else{
         echo "<font color='#FF0000'>超级管理员</font>";
	    }
      ?>
    </td>
    <td><A HREF="modadmin.php?id=<?=$id?>&mod_user=<?=$admin_user?>">[修改密码]</A></td>
    <td><A HREF="delop.php?op=del&id=<?=$id?>">[删除]</A></td>
  </tr>
<?
}
?>
  <tr bgcolor="#FFFFFF"> 
    <td height="25" colspan="15" 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=15 align=center class="f12"> 记录为空!</td>
  </tr>
<? }?>
</table>
<br>
</body>
</html>