我的论坛源代码(二)
作者:未知 来源:转载 发布时间:2005-7-30 20:52:27 发布人:acx
主界面,也就是显示主题列表的这页。
//foxbbs.php 功能:显示论坛的主题
<HTML>
<HEAD>
<TITLE>狐网论坛</TITLE>
<STYLE type=text/css>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<LINK href="js/lfox.css" rel=stylesheet /LINK>
<?php
include "linkfox.inc.php";
include "info.inc.php";
?>
</HEAD>
<body bgcolor="#FFFFFF">
<?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet]; //这里取COOKIE里的信息
$temp=explode("|",$tem); //因为用户名和密码是用"|"分隔并记录在COOKIE里的
$cookiem=$temp[0]; //取用户名
$useinfo=cuser($cookiem,$action); //CUSER这个函数是用来判别是否从COOKIE中取出了信息
$query="select usename from useinfo where usename='".$useinfo[0]."'"; //检查是否注册用户
$req=mysql_query($query);
if ($req)
{
$usename=mysql_fetch_array($req);
if($usename[0]==$useinfo[0]) $useinfo[0]=$usename[0];
else {
$usename=1;
$useinfo[0]="游客";
}
}
else $usename=1;$useinfo[0]="游客";
?>
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td height="40" rowspan="2" width="60%">
<div align="right"></div>
<div align="right"></div>
</td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
</tr>
<tr>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=xy"><img src="http://www.7880.com/Info/images/top_register.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="useinfo.php?action=find"><img src="http://www.7880.com/Info/images/top_members.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%"><a href="useinfo.php?action=edit"><img src="http://www.7880.com/Info/images/top_profile.gif" width="74" height="21" border="0"></a></td>
<td height="20" width="10%"><a href="okey.php?d=q"><img src="http://www.7880.com/Info/images/top_logout.gif" width="74" height="21" border="0"></a></td>
</tr>
<tr>
<td height="20" width=60%>
<div align="left">当前位置:<font color="#0000FF">狐网─>狐网论坛─>主题列表</font> <? echo "<font color='00dd00'>".$useinfo[2]."</font><font color='ff0000'>"; echo "欢迎你来到论坛!</font>"; ?></div>
</td>
<td height="20" width="10%">
<div align="center"><? echo "<a href='post.php'><img src='http://www.7880.com/Info/images/newthread.gif' width='70' height='20' border='0' alt='发布新帖'></a>"; ?></div>
</td>
<td height="20" width="10%">
<div align="center"><? if ($action==find) echo "<a href='foxbbs.php'><img src='http://www.7880.com/Info/images/dispall.gif' width='70' height='20' border='0' alt='显示所有贴子列表'></a>"; else echo "<a href='superuse.php' target='_blank'><img src='http://www.7880.com/Info/images/super.gif' border='0' alt='管理专区,非请莫进'></a>";?></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=dl"><img src="http://www.7880.com/Info/images/dl.gif" border="0" alt="登录用户"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="http://lfox.oso.com.cn/index.php" target="_blank"><img src="http://www.7880.com/Info/images/fox.gif" border="0" alt="返回狐网首页"></a></div>
</td>
</tr>
</table>
<? echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr bgcolor='#000000'><td><table width='100%' border='0' cellspacing='1' cellpadding='1'>";
?> <tr bgcolor="#229999">
<td width="5%">
<div align="center"><font color="#FFFFFF">状态</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">表情</font></div>
</td>
<td width="30%">
<div align="center"><font color="#FFFFFF">主 题</font></div>
</td>
<td width="25%">
<div align="center"><font color="#FFFFFF">作 者</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">回复</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">人气</font></div>
</td>
<td width="25%">
<div align="center"><font color="#FFFFFF">最后回复时间</font></div>
</td>
</tr>
<?php
$imgnum=20; //点击次数,准备改状态图
if (!$user) $user="all";
$query="select count(*) from foxbbs"; //首先计算总的论题数
$req=mysql_query($query);
if ($req)
{
$row=mysql_fetch_array($req);
$num=$row[0];
if (!$rows) $rows=10; //控制每页显示条数
if (!$l) $l=1; //设定排序方式
if ($num/$rows<1) $page=1; //计算总页数
else if($num/$rows==floor($num/$rows)) $page=$num/$rows;
else $page=floor($num/$rows)+1;
if (!$dpage) $dpage=1; //当前显示的页数
if ($dpage>$page) $dpage=$page; //不能超过最大页数
if ($dpage==1) $tem=0; //控制当前页应该显示的信息
else $tem=($dpage-1)*$rows;
if ($l==2) $s="hfnum";
else if ($l==3) $s="djnum";
else $s="id";
for ($i=0;$i<$rows;$i++) //根据设定的每页行数来取记录
{
$tem1=$tem+1;
if($action==find) $query="select * from foxbbs where usename='".$user."' order by $s desc limit $tem,$tem1";
else $query="select * from foxbbs order by $s desc limit $tem,$tem1";
$req=mysql_query($query);
if ($req)
{
$bbs=mysql_fetch_array($req); //看有没有回复时间,如果没有就取发帖时间代替回复时间
if ($bbs[3])
{
if (!$bbs[8]) $bbs[8]=$bbs[4]." ".$bbs[1];
else $bbs[8]=$bbs[8]." ".$bbs[10];
if (substr($bbs[4],0,-8)==date(Y年n月j日)&&$bbs[6]<$imgnum&&$bbs[12]!=1) // 如果是当天的帖子
$img="http://www.7880.com/Info/images/newfolder.gif";
else if(substr($bbs[4],0,-8)==date(Y年n月j日)&&$bbs["djnum"]>=$imgnum&&$bbs[12]!=1) //如果是
//foxbbs.php 功能:显示论坛的主题
<HTML>
<HEAD>
<TITLE>狐网论坛</TITLE>
<STYLE type=text/css>
P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt}
</STYLE>
<LINK href="js/lfox.css" rel=stylesheet /LINK>
<?php
include "linkfox.inc.php";
include "info.inc.php";
?>
</HEAD>
<body bgcolor="#FFFFFF">
<?
$tem=$HTTP_COOKIE_VARS[FlyFoxNet]; //这里取COOKIE里的信息
$temp=explode("|",$tem); //因为用户名和密码是用"|"分隔并记录在COOKIE里的
$cookiem=$temp[0]; //取用户名
$useinfo=cuser($cookiem,$action); //CUSER这个函数是用来判别是否从COOKIE中取出了信息
$query="select usename from useinfo where usename='".$useinfo[0]."'"; //检查是否注册用户
$req=mysql_query($query);
if ($req)
{
$usename=mysql_fetch_array($req);
if($usename[0]==$useinfo[0]) $useinfo[0]=$usename[0];
else {
$usename=1;
$useinfo[0]="游客";
}
}
else $usename=1;$useinfo[0]="游客";
?>
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td height="40" rowspan="2" width="60%">
<div align="right"></div>
<div align="right"></div>
</td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
<td height="20" width="10%"> </td>
</tr>
<tr>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=xy"><img src="http://www.7880.com/Info/images/top_register.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="useinfo.php?action=find"><img src="http://www.7880.com/Info/images/top_members.gif" width="74" height="21" border="0"></a></div>
</td>
<td height="20" width="10%"><a href="useinfo.php?action=edit"><img src="http://www.7880.com/Info/images/top_profile.gif" width="74" height="21" border="0"></a></td>
<td height="20" width="10%"><a href="okey.php?d=q"><img src="http://www.7880.com/Info/images/top_logout.gif" width="74" height="21" border="0"></a></td>
</tr>
<tr>
<td height="20" width=60%>
<div align="left">当前位置:<font color="#0000FF">狐网─>狐网论坛─>主题列表</font> <? echo "<font color='00dd00'>".$useinfo[2]."</font><font color='ff0000'>"; echo "欢迎你来到论坛!</font>"; ?></div>
</td>
<td height="20" width="10%">
<div align="center"><? echo "<a href='post.php'><img src='http://www.7880.com/Info/images/newthread.gif' width='70' height='20' border='0' alt='发布新帖'></a>"; ?></div>
</td>
<td height="20" width="10%">
<div align="center"><? if ($action==find) echo "<a href='foxbbs.php'><img src='http://www.7880.com/Info/images/dispall.gif' width='70' height='20' border='0' alt='显示所有贴子列表'></a>"; else echo "<a href='superuse.php' target='_blank'><img src='http://www.7880.com/Info/images/super.gif' border='0' alt='管理专区,非请莫进'></a>";?></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="reguse.php?action=dl"><img src="http://www.7880.com/Info/images/dl.gif" border="0" alt="登录用户"></a></div>
</td>
<td height="20" width="10%">
<div align="center"><a href="http://lfox.oso.com.cn/index.php" target="_blank"><img src="http://www.7880.com/Info/images/fox.gif" border="0" alt="返回狐网首页"></a></div>
</td>
</tr>
</table>
<? echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr bgcolor='#000000'><td><table width='100%' border='0' cellspacing='1' cellpadding='1'>";
?> <tr bgcolor="#229999">
<td width="5%">
<div align="center"><font color="#FFFFFF">状态</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">表情</font></div>
</td>
<td width="30%">
<div align="center"><font color="#FFFFFF">主 题</font></div>
</td>
<td width="25%">
<div align="center"><font color="#FFFFFF">作 者</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">回复</font></div>
</td>
<td width="5%">
<div align="center"><font color="#FFFFFF">人气</font></div>
</td>
<td width="25%">
<div align="center"><font color="#FFFFFF">最后回复时间</font></div>
</td>
</tr>
<?php
$imgnum=20; //点击次数,准备改状态图
if (!$user) $user="all";
$query="select count(*) from foxbbs"; //首先计算总的论题数
$req=mysql_query($query);
if ($req)
{
$row=mysql_fetch_array($req);
$num=$row[0];
if (!$rows) $rows=10; //控制每页显示条数
if (!$l) $l=1; //设定排序方式
if ($num/$rows<1) $page=1; //计算总页数
else if($num/$rows==floor($num/$rows)) $page=$num/$rows;
else $page=floor($num/$rows)+1;
if (!$dpage) $dpage=1; //当前显示的页数
if ($dpage>$page) $dpage=$page; //不能超过最大页数
if ($dpage==1) $tem=0; //控制当前页应该显示的信息
else $tem=($dpage-1)*$rows;
if ($l==2) $s="hfnum";
else if ($l==3) $s="djnum";
else $s="id";
for ($i=0;$i<$rows;$i++) //根据设定的每页行数来取记录
{
$tem1=$tem+1;
if($action==find) $query="select * from foxbbs where usename='".$user."' order by $s desc limit $tem,$tem1";
else $query="select * from foxbbs order by $s desc limit $tem,$tem1";
$req=mysql_query($query);
if ($req)
{
$bbs=mysql_fetch_array($req); //看有没有回复时间,如果没有就取发帖时间代替回复时间
if ($bbs[3])
{
if (!$bbs[8]) $bbs[8]=$bbs[4]." ".$bbs[1];
else $bbs[8]=$bbs[8]." ".$bbs[10];
if (substr($bbs[4],0,-8)==date(Y年n月j日)&&$bbs[6]<$imgnum&&$bbs[12]!=1) // 如果是当天的帖子
$img="http://www.7880.com/Info/images/newfolder.gif";
else if(substr($bbs[4],0,-8)==date(Y年n月j日)&&$bbs["djnum"]>=$imgnum&&$bbs[12]!=1) //如果是
上一篇:我的论坛源代码(一)
下一篇:我的论坛源代码(三)