<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style.css" rel="stylesheet">
<?php
include("../conn/conn.php");
%包含数据库连接文件
$flag=$_POST[commend];
%获得“推荐状态”的值
if($_POST[commend]==""){
$flag=$_GET[flag];
%若没有设置“推荐状态”,flag值为默认值“为推荐”
}
if($flag=="all"){
$sql1=mysql_query("select count(*) as total from tb_advertising order by flag desc");
%flag是“全部”,则选择所有的广告
}else{
$sql1=mysql_query("select count(*) as total from tb_advertising where flag='$flag' order by flag desc");
%若不是“全部”,则选择相应的状态的广告
}
$minfo=mysql_fetch_array($sql1);
%获得结果
$total=$minfo[total];
%获得总的数据条数
$pagesize=10;
%每页显式10条
if($total<=$pagesize){
$pagecount=1;
%总数不超过10条,pagecount按1计
}
if(($total%$pagesize)!=0){
$pagecount=intval($total/$pagesize)+1;
%不能被整除,则加1
}else{
$pagecount=$total/$pagesize;
%整除则直接赋值
}
if(($_GET[page])==""){
$page=1;
%默认显式第一页
}else{
$page=intval($_GET[page]);
%否则显式相应的页
}
if($flag=="all"){
$sql=mysql_query("select * from tb_advertising order by flag desc limit ".($page-1)*$pagesize.",$pagesize");
%若是返回全部结果,则选择相应的某页
}else{
$sql=mysql_query("select * from tb_advertising where flag='$flag' order by flag desc limit ".($page-1)*$pagesize.",$pagesize");
}
$info=mysql_fetch_array($sql);
%获得结果
?>
<table width="776" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="32" background="images/right_line.gif"> 您现在的位置:九九度供求信息网 > 后台管理系统</td>
</tr>
<tr>
<td height="32" background="images/right_top.gif"> </td>
</tr>
<tr>
<td height="488" align="center" valign="top" background="images/right_middle.gif"> <table width="700" border="1" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFCC33">
<tr align="center" bgcolor="#FFCC33">
<td width="141" bgcolor="#FFCC33">广告标题</td>
<td width="291">广告内容</td>
<td width="123">发布时间</td>
<td width="64">是否推荐</td>
<td width="63" height="22">操作</td>
</tr>
<?php
if($info){
do{
if($info[flag]=="1"){
$flag1="已推荐";
}else{
$flag1="未推荐";
}
?>
<tr bgcolor="#FFFFFF">
<td> <?php echo $info[title];?></td>
<td> <?php echo $info[content];?></td>
<td> <?php echo $info[fdate];?></td>
<td align="center" bgcolor="#FFFFFF" class="style11"> <?php echo $flag1;?></td>
<td align="center" bgcolor="#FFFFFF"><a href="gg_ok.php?id=<?php echo $info[id];?>&flag=<?php echo $flag; ?>">推荐</a>/<a href="del_ok.php?id=<?php echo $info[id];?>&flag=<?php echo $flag; ?>">删除</a></td>
</tr>
<?php
}while($info=mysql_fetch_array($sql));
?>
<tr bgcolor="#FFFFDD">
<td height="22" colspan="8" align="right"> 共有
<?php
echo $total;
?>
条 每页显示 <?php echo $pagesize;?> 条 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页
<?php
if($page>=2){
?>
<a href="find_gg.php?flag=<?php echo $flag;?>&page=1" title="首页"></a> <a href="find_gg.php?flag=<?php echo $flag;?>&page=<?php echo $page-1;?>" title="上一页"></a>
<?php
}
if($pagecount<=4){
for($i=1;$i<=$pagecount;$i++){
?>
<a href="find_gg.php?flag=<?php echo $flag;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php
}
}else{
for($i=1;$i<=4;$i++){
?>
<a href="find_gg.php?flag=<?php echo $flag;?>&page=<?php echo $i;?>"><?php echo $i;?></a>
<?php }?>
<a href="find_gg.php?flag=<?php echo $flag;?>&page=<?php echo $page-1;?>" title="下一页"></a> <a href="find_gg.php?flag=<?php echo $flag;?>&page=<?php echo $pagecount;?>" title="尾页"></a>
<?php }?>
</td>
</tr>
<?php
}else{
?>
<tr align="center" bgcolor="#FFFFFF">
<td colspan="8">对不起,您检索的信息不存在!</td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td height="32" background="images/right_bottom.gif"> </td>
</tr>
</table>