【php开源代码栏目提醒】:网学会员为广大网友收集整理了,bbs_list.php,希望对大家有所帮助!
<?php
include_once("top.php");
include_once("bbs_top.php");
?>
<table width="870" align="center" border="1" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#6EBEC7">
<tr><td bgcolor="#FFFFFF">
<table width="800" height="3" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<?php
$typeid=$_GET[id];
$sql=mysql_query("select * from tb_type_small where id='".$typeid."'",$conn);
$info=mysql_fetch_array($sql);
?>
<script language="javascript">
</script>
<script language="javascript">function ShowTR(objImg,objTr){
if(objTr.style.display == ""){
objTr.style.display = "none";
objImg.src = "images/jia.gif";
objImg.alt = "展开";
}else{
objTr.style.display = "";
objImg.src = "images/jian.gif";
objImg.alt = "折叠";
}
}
</script>
<table width="750" height="20" border="0" align="center" cellpadding="0" cellspacing="0" background="images/lt_15(2).jpg">
<tr><td height="2"></td></tr>
<tr>
<td width="740" class="a9"><div align="left"> <?php echo unhtml($info[title]);?> 版块</div></td>
<td width="160"><div align="center"><span class="a13">【</span> <a href="
<?php
if($_SESSION["unc"]!=""){
?>
bbs_pubbs.php?ids=<?php echo unhtml($info[title]);?>&id=<?php echo $info[id];?>
<?php
}else{
echo "javascript:alert('请先登录本站,然后发表帖子!');window.location.href='index.php';";
}
?>
" class="a8">发表帖子</a> <span class="a13">】</span></div></td>
</tr>
</table>
<table width="750" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#6EBEC7" id="tab_list">
<?php
$sql=mysql_query("select count(*) as total from tb_bbs where typeid='".$typeid."'",$conn);
$info=mysql_fetch_array($sql);
$total=$info[total];
if($total==0)
{
echo "<tr>";
echo "<td height=\"25\" bgcolor=\"#FFFFFF\"><div align=\"center\">该讨论区无人发贴!</div></td>";
echo "</tr>";
}
else
{
if(empty($_GET[page])==true || is_numeric($_GET[page])==false)
{
$page=1;
}
else
{
$page=intval($_GET[page]);
}
$pagesize=30;
if($total<$pagesize)
{
$pagecount=1;
}
else
{
if($total%$pagesize==0)
{
$pagecount=intval($total/$pagesize);
}
else
{
$pagecount=intval($total/$pagesize)+1;
}
}
?>
<tr>
<td width="51" height="23" bgcolor="#F0F5FA"><div align="center">状 态</div></td>
<td width="41" bgcolor="#F0F5FA"><div align="center">心 情</div></td>
<td width="462" height="23" bgcolor="#F0F5FA"><div align="center">主 题</div></td>
<td width="79" bgcolor="#F0F5FA"><div align="center">回复|人气</div></td>
<td width="122" bgcolor="#F0F5FA"><div align="center">版 主</div></td>
<td width="159" bgcolor="#F0F5FA"><div align="center">发贴时间</div></td>
</tr>
<?php
$sql=mysql_query("select * from tb_bbs where typeid='".$typeid."' order by top desc,createtime desc,lastreplytime desc limit ".($page-1)*$pagesize.",$pagesize",$conn);
while($info=mysql_fetch_array($sql))
{
?>
<tr>
<td height="23" bgcolor="#E9F3FF"><div align="center">
<?php
if($info[top]==1){
echo "<img src=\"images/lt_15(4).jpg\" width=\"30\" height=\"25\">";
}else{
if($info[readtimes]>=5)
{
echo "<img src=\"images/lt_15(4).jpg\" width=\"30\" height=\"25\">";
}
else
{
echo " <img src=\"images/lt_15(4).jpg\" width=\"30\" height=\"25\">";
}
}
?>
</div></td>
<td height="23" bgcolor="#E9F3FF"><div align="center"><img src="<?php echo $info[head];?>" /></div></td>
<td height="23" bgcolor="#E9F3FF" class="a12"> <img src="images/jia.gif" border="0" alt="展开" id="img<?php echo $info[id];?>" onclick="ShowTR(img<?php echo $info[id];?>,tr<?php echo $info[id];?>)" />
<?php
include_once("function.php");
if($info[top]==1){
echo "<a href=\"bbs_look
bbs.php?id=".$info[id]."\" class=a1>".unhtml($info[title])."";
}else{
echo "<a href=\"bbs_lookbbs.php?id=".$info[id]."\" class=a1>".unhtml($info[title]);
}
?>
<div align="left"></div></td>
<td height="23" bgcolor="#E9F3FF"><div align="center">
<?php
$
sql1=
mysql_query("select count(*) as total from tb_reply where bbsid='".$info[id]."'",$conn);
$info1=mysql_fetch_array($sql1);
echo $info1[total];
?>
| <?php echo $info[readtimes];?></div></td>
<td height="23" bgcolor="#E9F3FF"><div align="center">
<?ph