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

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

if ($searchcontent==""){
	$str="select * from {$tablepre}ftbbs_upload where bbs_blog_type=".$a." and upload_pic not like '%flashad%' order by id desc";
}
else{
	$str="select * from {$tablepre}ftbbs_upload where bbs_blog_type=".$a." and upload_pic 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,"a" => $a));
$p->set(24,$numrows,$psize); 
$rsx=mysql_query($str." limit ".$p->limit());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>上传图片管理</title>
<link href="../css/main01.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <TR align=center> 
    <FORM METHOD=POST ACTION="" >
	  <TD width="61%" align="left">
      <?
	  $p->output(0);
	  ?>
	  </TD>
      <TD width="39%" height="25"> <div align="right">
          <INPUT NAME="searchcontent" TYPE="text" value="文件名" size=20>
          <INPUT TYPE="submit" value="搜索" name="">
        </div></TD>
    </FORM>
  </TR>
</TABLE>
<table width="99%" border="0" bgcolor="#EDE9EC" cellspacing="1" cellpadding="0" align="center">
  <tr bgcolor="#FFFFFF" align=center class="f12"> 
<?
if ($numrows!=0){
  while ($myrow = mysql_fetch_array($rsx)) {
  $i++;
?>
    <td>
	<?
	if ($myrow["upload_ext"]=="jpg" || $myrow["upload_ext"]=="gif" || $myrow["upload_ext"]=="bmp"){
	echo "<img src=../".$myrow["upload_pic"]." width=\"90\" height=\"90\">";
	}
	else{
	echo $myrow["upload_ext"]."文件";
	}
	?>
	<br>
      <? if ($myrow["sign"]==0){?>
      <A HREF="delpic.php?pic=<?=$myrow["upload_pic"]?>&id=<?=$myrow["id"]?>&sign=1&a=<?=$a?>" title="设为首页显示"><font color=red>显</font></a> 
      <? }else{?>
      <A HREF="delpic.php?pic=<?=$myrow["upload_pic"]?>&id=<?=$myrow["id"]?>&sign=0&a=<?=$a?>" title="设为首页不显示">隐</a> 
      <? }?>
      <? if ($myrow["sign"]==3){?>
      <A HREF="delpic.php?pic=<?=$myrow["upload_pic"]?>&id=<?=$myrow["id"]?>&sign=0&a=<?=$a?>" title="取消幻灯图片"><font color=red>取消幻灯</font></a> 
      <? }else{?>
      <A HREF="delpic.php?pic=<?=$myrow["upload_pic"]?>&id=<?=$myrow["id"]?>&sign=3&a=<?=$a?>" title="设为幻灯图片">设为幻灯</a> 
      <? }?>
      <A HREF="delpic.php?pic=<?=$myrow["upload_pic"]?>&id=<?=$myrow["id"]?>&a=<?=$a?>">删除</A></td>
<?
  if ($i % 4==0){
  echo "<tr bgcolor=\"#FFFFFF\" align=center class=\"f12\">";
  }
}
?>
  </tr>
  <tr align=center 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>
</body>
</html>