当前位置:编程学习 > php >>

我的论坛源代码(二)

答案: 主界面,也就是显示主题列表的这页。
//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=><?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=> </td>
<td height="20" width="10%">
<div align="center"><a href=> </td>
<td height="20" width="10%"><a href=> <td height="20" width="10%"><a href=> </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=> </td>
<td height="20" width="10%">
<div align="center"><? if ($action==find) echo "<a href=> </td>
<td height="20" width="10%">
<div align="center"><a href=> </td>
<td height="20" width="10%">
<div align="center"><a href=> </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"; <

上一个:我的论坛源代码(七)
下一个:PHP的FTP学习(一)

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,