<?
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"]);
if ($searchcontent==""){
$searchcontent=$_GET["searchcontent"];
}

if ($searchcontent==""){
	$str="select * from {$tablepre}links order by id desc";
}
else{
	$str="select * from {$tablepre}links where ftbbs_name 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));
$p->set($pagesize,$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">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <TR align=center class="f12">
    <TD width="59%" height="25" align="left">
      <?
	  $p->output(0);
	  ?>
   </TD>
     <FORM METHOD=POST ACTION="" >
      <TD width="41%"> <div align="right">
          <INPUT TYPE="text" NAME="searchcontent" size=20>
          <INPUT TYPE="submit" value="搜索" name="">
        </div></TD>
    </FORM>
  </TR>
</TABLE>
<table width="99%" border="0" bgcolor="#cccccc" cellspacing="1" cellpadding="0" align="center">
  <tr bgcolor="#f1f1f1" align=center class="f12"> 
    <td width="6%" height="25">编号</td>
    <td width="13%">论坛名称</td>
    <td width="9%">类型</td>
    <td width="34%">URL</td>
    <td width="17%">日期</td>
    <td width="10%">状态</td>
    <td width="11%">删除</td>
  </tr>
  <?
if ($numrows!=0){
  while ($myrow = mysql_fetch_array($rsx)) {
  $i++;
?>
  <tr bgcolor="#FFFFFF" align=center class="f12"> 
    <td height="25"> 
      <?=$i?>
    </td>
    <td> 
      <?=$myrow["ftbbs_name"]?>
    </td>
    <td>
      <?
	if ($myrow["ftbbs_class"]=="1"){
	   echo "<font color=green>文字链接</font>";
	}
	else{
	  echo "<font color=red>图片logo</font>";
	}
	?>
    </td>
    <td align="left"> 
      <?=$myrow["ftbbs_url"]?>
	  <?
	  if ($myrow["ftbbs_class"]!="1"){
	     echo "<br>logo图片:".$myrow["ftbbs_logo"];
	  }
	  ?>
    </td>
    <td> 
      <?=$myrow["ftbbs_time"]?>
    </td>
    <td> 
      <?
	if ($myrow["ftbbs_pass"]=="Y"){
	   echo "<a href=linkop.php?id=".$myrow["id"]."&flag=N>已核审</a>";
	}
	else{
	  echo "<a href=linkop.php?id=".$myrow["id"]."&flag=Y><font color=red>未核审</font></a>";
	}
	?>
    </td>
    <td><A HREF="../user/ftbbsdel.php?tb=links&flag=3&id=<?=$myrow["id"]?>">[删除]</A></td>
  </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>