<?
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");

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

$searchcontent=trim($_POST["searchcontent"]);
$searchkind=$_POST["searchkind"];
if ($searchcontent==""){
$searchcontent=$_GET["searchcontent"];
$searchkind=$_GET["searchkind"];
}

if ($searchkind==""){
	$str="select * from {$tablepre}sms order by id desc";
}
else{
	$str="select * from {$tablepre}sms where ".$searchkind." like '%".$searchcontent."%' order by id desc";
}
$rs=mysql_query($str);
$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
$p = new ft_page;
$p->pvar="page"; 
$p->setvar(array("searchcontent" => $searchcontent, "searchkind" => $searchkind));
$p->set($pagesize,$numrows,$psize); 
$rsx=mysql_query($str." limit ".$p->limit());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>">
<link href="../css/main01.css" rel="stylesheet" type="text/css">
<script src="../js/publicfun.js" type="text/javascript"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <TR align="center" class="f12"> 
    <FORM METHOD=POST ACTION="" >
	  <TD width="55%" height="25" align="left">
      <?
	  $p->output(0);
	  ?>
      </TD>
      <TD width="45%" align="right"> <INPUT TYPE="text" NAME="searchcontent" size=20> <select name="searchkind">
          <option value="title">标题</option>
          <option value="content">内容</option>
        </select> <INPUT TYPE="submit" value="搜索" name=""> <A HREF="adminpostsms.php">[发送系统短信]</A></TD>
    </FORM>
  </TR>
</TABLE>
<table width="98%" border="0" bgcolor="#cccccc" cellspacing="1" cellpadding="0" align="center">
  <tr bgcolor="#f3f3f3" align=center class="f12"> 
    <td width="5%" height="23" bgcolor="#f3f3f3">选择</td>
    <td width="5%" bgcolor="#f3f3f3">编号</td>
    <td width="20%">标题</td>
    <td width="42%">内容</td>
    <td width="18%">日期</td>
    <td width="10%">修改</td>
  </tr>
  <form name="selectform" method=post action="pldelsms.php">
    <input type="hidden" name="op" value="选择转正">
    <input type="hidden" name="returnURL" value="managesms.php">
    <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)) {
  $i++;
?>
    <tr bgcolor="#FFFFFF" align=center class="f12"> 
      <td height="23">
<input name="checkbox1[]" type="checkbox" id="checkbox1" value="<?=$myrow["id"]?>">
      </td>
      <td height="20"><?=$i?></td>
      <td align="left"><?=$myrow["title"]?></td>
      <td align="left"><?=$myrow["content"]?></td>
      <td><?=$myrow["indate"]?></td>
      <td>
	  <? if (false!==strrpos($_SESSION["admin_qs"],"2")){?>
	  <A HREF="admineditsms.php?id=<?=$myrow["id"]?>">[修改]</A>
	  <? }?>
	  </td>
    </tr>
<?
}
?>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="12"> 
        <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<? }?>>
      </td>
    </tr>
  <tr align=center bgcolor="#FFFFFF"> 
    <td colspan="15"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
            <td height="25" colspan=15 bgcolor="#FFFFFF"> 
              <?
     $p->output(0);
     mysql_free_result($rs);
     mysql_free_result($rsx);
     $db->close(); 
    ?>
            </td>
        </tr>
      </table></td>
  </tr>
  </form>
<? }else{?>
  <tr bgcolor="#F2F9F9"> 
    <td height="25" colspan=15 align=center class="f12"> 记录为空!</td>
  </tr>
<? }?>
</table>
</body>
</html>