find_fufei.php源码分析

<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link href="../css/style.css" rel="stylesheet">

<?php

include("../conn/conn.php");

%包含conn.php

$state=$_POST[payfor];

%获取付费状态

$type=$_POST[select];

%获取选择的类型

if($_POST[select]==""){

%若没有选择类型

$state=$_GET[state];

$type=$_GET[type];

%则使用默认的状态和类型

}

if($state=="all"){

$sql1=mysql_query("select count(*) as total from tb_leaguerinfo where

type='$type' order by id");

%如果类型是“全部”,那么就查询所有的对应类型的结果

}else{

$sql1=mysql_query("select count(*) as total from tb_leaguerinfo where

type='$type' and checkstate=$state order by id");

%否则查询相应类型和相应状态的结果

}

$minfo=mysql_fetch_array($sql1);

%根据查询语句,获得满足条件的结果

$total=$minfo[total];

%获取结果数

$pagesize=4;

if($total<=$pagesize){

$pagecount=1;

%如果结果数小于pagesize,那么页数为1

}

if(($total%$pagesize)!=0){

$pagecount=intval($total/$pagesize)+1;

%若total不能被pagesize整除,则将pagecount赋为total/pagesize的取整加1

}else{

$pagecount=$total/$pagesize;

%若能整除,则直接赋值为total/pagesize

}

if(($_GET[page])==""){

$page=1;

%若没有显式指定page的值,则默认为第一页

}else{

$page=intval($_GET[page]);

%否则page为GET方法指定的页

}

if($state=="all"){

$sql=mysql_query("select * from tb_leaguerinfo where type='$type' order by id

limit ".($page-1)*$pagesize.",$pagesize");

%LIMIT 子句可以被用于强制 Select 语句返回指定的记录数。LIMIT 接受一个或两个数

%字参数。参数必须是一个整数常量。如果给定两个参数,第一个参数指定第一个返回记

%录行的偏移量,第二个参数指定返回记录行的最大数目。初始记录行的偏移量是 0(而不

%是 1): 为了与 PostgreSQL 兼容,MySQL 也支持句法: LIMIT # OFFSET #。

%mysql> Select * FROM table LIMIT 5,10; # 检索记录行 6-15

}else{

$sql=mysql_query("select * from tb_leaguerinfo where type='$type' and

checkstate=$state order by id 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您现在的

位置:九九度供求信息网&nbsp;&gt;&nbsp;后台管理系统</td>

</tr>

<tr>

<td height="32" background="images/right_top.gif">&nbsp;</td>

</tr>

<tr>

<td height="488" align="center" valign="top" background="images/right_middle.gif">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n

bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n

bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;当前信息类别:&nbsp;『<span class="style11">&nbsp;<?php echo

$type;?>&nbsp;</span>』<br>

<table width="709" border="0" cellpadding="0" cellspacing="1"

bgcolor="#FFCC33">

<tr align="center" bgcolor="#FFCC33">

<td width="76">信息标题</td>

<td width="204">信息内容</td>

<td width="65">联系人</td>

<td width="88">联系电话</td>

<td width="79">发布日期</td>

<td width="72">截止日期</td>

<td width="54">审核状态</td>

<td width="62">操作</td>

</tr>

<?php

if($info){

do{

if($info[checkstate]==1){

$state1="已付费";

}else{

$state1="未付费";

}

?>

<tr bgcolor="#FFFFFF">

<td>&nbsp;<?php echo $info[title];?></td>

<td width="204">&nbsp;<?php echo $info[content];?></td>

<td>&nbsp;<?php echo $info[linkman];?></td>

<td>&nbsp;<?php echo $info[tel];?></td>

<td>&nbsp;<?php echo $info[sdate];?></td>

<td>&nbsp;<?php echo $info[showday];?></td>

<td align="center" class="style11"><?php echo $state1;?></td>

<td align="center" bgcolor="#FFFFFF"><a href="statefu_ok.php?id=<?php echo

$info[id];?>&type=<?php echo $type;?>&state=<?php echo $state;?>">审核</a>/<a

href="fudel_ok.php?id=<?php echo $info[id];?>&type=<?php echo $type;?>&state=<?php

echo $state;?>">删除</a></td>

</tr>

<?php

}while($info=mysql_fetch_array($sql));

?>

<tr bgcolor="#FFFFDD">

<td height="22" colspan="8" align="right"> &nbsp; 共有&nbsp;

<?php

echo $total;

?>

&nbsp;条&nbsp;每页显示&nbsp;<?php echo $pagesize;?>&nbsp;条&nbsp;第&nbsp;<?php echo

$page;?>&nbsp;页/共&nbsp;<?php echo $pagecount; ?>&nbsp;页

<?php

if($page>=2){

?>

<a href="find_fufei.php?type=<?php echo $type;?>&state=<?php echo $state;?

>&page=1" title="首页"></a> <a href="find_fufei.php?type=<?php echo $type;?>&state=<?

php echo $state;?>&page=<?php echo $page-1;?>" title="上一页"></a>

<?php

}

if($pagecount<=4){

for($i=1;$i<=$pagecount;$i++){

?>

<a href="find_fufei.php?type=<?php echo $type;?>&state=<?php echo $state;?

>&page=<?php echo $i;?>"><?php echo $i;?></a>

<?php

}

}else{

for($i=1;$i<=4;$i++){

?>

<a href="find_fufei.php?type=<?php echo $type;?>&state=<?php echo $state;?

>&page=<?php echo $i;?>"><?php echo $i;?></a>

<?php }?>

<a href="find_fufei.php?type=<?php echo $type;?>&state=<?php echo $state;?

>&page=<?php echo $page-1;?>" title="下一页"></a> <a href="find_fufei.php?type=<?php

echo $type;?>&state=<?php echo $state;?>&page=<?php echo $pagecount;?>" title="尾

页"></a>

<?php }?>

&nbsp;</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">&nbsp;</td>

</tr>

</table>

你可能感兴趣的:(sql,mysql,PHP,css,PostgreSQL)