基于mysql的论坛(4)


Posted in PHP onOctober 09, 2006

## index.php
<html>
<head>
<title>论坛</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<frameset cols="125,*" rows="*" border="0" frameborder="0">  
  <frame src="left.php" name="left" scrolling="AUTO" frameborder="YES" bordercolor="#000000">
  <frame src="right.htm" name="main" scrolling="AUTO">
</frameset>
<noframes><body bgcolor="#FFFFFF">

</body></noframes>
</html>
## left.php
<?php
$fp=fopen("file/counter.txt","r");
$counter=fgets($fp,8);
fclose($fp);
$counter=$counter+1;
$fp=fopen("file/counter.txt","w");
fputs($fp,$counter);
fclose($fp);
require("config.inc.php");
$sql="select * from boardinfo";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
?>
<html>
<head>
<title>版面列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/new.css" rel=stylesheet>
</head>

<body background="image/bg.gif" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
  <tr>
    <td align="center"> </td>
  </tr>
  <tr>
    <td align="center"><a href="apply.php" target="main">注册用户</a></td>
  </tr>
  <tr>
    <td align="center"><font color="#666666">---------</font></td>
  </tr>
<?php
do
{
echo"<tr>";
echo"<td align="center"><a href="list.php?board=$sql_row[name]" target="main">$sql_row[chinesename]</a></td>";
echo"</tr>";
}while($sql_row=mysql_fetch_array($sql_result));
?>
<tr>
    <td align="center"><font color="#006666">---------</font></td>
  </tr>
  <tr>
    <td height="11">
      <script src=file/X86tree.js></script>
      <script language=javascript>
        img_t1="image/t1.gif";
        img_t2="image/t2.gif";
        tree=new TreeView(0,0,640,300);
        tree.AddImage(0,"image/dot.gif");
        tree.AddImage(1,"image/close.gif");
        tree.AddImage(2,"image/open.gif");

        m1=new Nodes("m1",tree.ImageList,"论坛转向",0,2,"");
        m1.Add(new Node("站点首页",1,0,"<a href='http://www.jlbusiness.com' target='_top'>"));                                                              m1.Add(new Node("论坛首页",1,0,"<a href='right.htm' target='main'>"));
    tree.Add2(m1);

        doc2=new Nodes("doc2",tree.ImageList,"论坛功能",0,2,"-");
            doc2.Add(new Node("帖子查询",1,0,"<a href='query.php' target='main'>"));
            doc2.Add(new Node("精华区域",1,0,"<a href='good.php' target='main'>"));
                doc2.Add(new Node("察看留言",1,0,"<a href='vmlogin.php' target='main'>"));
                doc2.Add(new Node("修改资料",1,0,"<a href='modify_l.php' target='main'>"));
                doc2.Add(new Node("察看资料",1,0,"<a href='userinfo.php' target='main'>"));
                doc2.Add(new Node("察看积分",1,0,"<a href='viewscore.php' target='main'>"));
                doc2.Add(new Node("论坛管理",1,0,"<a href='manage.htm' target='main'>"));
        tree.Add2(doc2);

        tree.Show();
        doc2.Close();
        m1.Close();
</script>
    </td>
  </tr>
  <tr>
    <td align="center"> <b><font color="#006666">--------</font><br>
      <?php echo "$counter"?></b></td>
  </tr>
</table>
</body>
</html>
## list.php
<?php
require("func.php");
if(empty($board)){
    $board="computer";
}
$sql="select * from boardinfo where name='$board'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
$chinesename=$sql_row[chinesename];
setcookie ("jl_forum[chinesename]",$chinesename);
$sql="select name from user where slaveboard='$board'";
$sql_result=mysql_query($sql);
?>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/index.css">
<script language="javascript">
function openwin(board,id){                window.open("read.php?board="+board+"&id="+id,"","height=460,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function post(board){                window.open("post.php?board="+board,"","height=500,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>
</head>

<body bgcolor="#FFFFFF" background="image/bg.gif">
<?php include "header.php";?> <br>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
  <tr>  
    <td height="22" width="23%" bgcolor="#eeeeee">版面:<?php
echo $chinesename;
?></td>
    <td height="22" width="41%" bgcolor="#eeeeee">版主:<?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo "$sql_row[name]"." ";
}
# 选择出留言纪录;
$sql="select * from $board where slaveid=0";
$temp=mysql_query($sql);
$sum=mysql_num_rows($temp);
$totalpage=ceil($sum/$pagesize);
if ($sum==0) {
    $totalpage=1;
}
# 分页
if($page<1 or empty($page)){
    $page=1;
}
elseif ($page>$totalpage){
         $page=$totalpage;
}
$offset=($page-1)*$pagesize;
$sql="select * from $board where slaveid=0 order by id desc limit $offset,$pagesize";
$sql_result=mysql_query($sql);
?> </td>
    <td height="22" width="13%" bgcolor="#eeeeee">贴子总数:<?php echo $sum; ?></td>
    <td height="22" width="12%"><a href='javascript:post("<?php echo $board;?>")'><img src="image/newtopic.jpg" width="93" height="21" border="0" alt="发新贴子"></a></td>
    <td height="22" width="11%">  
      <div align="center"><a href="<?php echo "$php_self?board=$board&page=$page";?>">刷新浏览</a></div>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr bgcolor="#995100" align="center">
    <td width="6%"><font color="#FFFFFF">回应</font></td>
    <td width="67%" bgcolor="#995100"><font color="#FFFFFF">主 题</font></td>
    <td width="20%"><font color="#FFFFFF">时 间</font></td>
    <td width="7%"><font color="#FFFFFF">人气</font></td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td colspan="5" height="2"> </td>
  </tr>
  <?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo"<tr>";
echo"<td width="6%" bgcolor="#FFF5DD" align="center">";
if ($sql_row[renum]!=0)
      {
       echo "<font color="#FF0000">[+$sql_row[renum]]</font>";
      }
else
{
echo "[0]";
}
  echo"</td>";
  echo"<td bgcolor="#E8FDEE" width="56%"><font face="宋体"><a href='javascript:openwin("$board",$sql_row[id])' title="作者:$sql_row[writer] 大小:$sql_row[size]字节">$sql_row[title]</a></font></td>";
  echo"<td width="18%" bgcolor="#FFF5DD" align="center">$sql_row[writetime]</td>";
  echo"<td width="6%" bgcolor="#E8FDEE" align="center">$sql_row[hits]</td>";
  echo"</tr>";
}
?>
  <tr bgcolor="#FFCC99">
    <td colspan="5" align="center" height="2"> </td>
  </tr>
</table>
<div align="right">
<form method="post" action="<?php echo $php_self;?>">
    共<b><?php echo $totalpage;?></b>页 第<b><?php echo $page;?></b>页·<?php
if ($page!=1){
     $back=$page-1;
        echo"<a href="$php_self?board=$board&page=1">首页</a> <a href="$php_self?board=$board&page=$back">上一页</a>";
}
if ($page==1){
       echo"首页 上一页";
}
if($page!=$totalpage){
    $next=$page+1;
        echo" <a href="$php_self?board=$board&page=$next">下一页</a> <a href="$php_self?board=$board&page=$totalpage">尾页</a>";
}
if($page==$totalpage){
        echo" 下一页 尾页";
}
?>·  
    <input type="submit" name="goto" value="转到">
    <input type="text" name="page" size="2">
    页  
  </form>
</div>
<?php include "footer.php";?>
</body>
</html>
## login.php
<?php
require "func.php";
if ($name==$admin_name and $password==$admin_password) {
    setcookie ("jl_admin[name]",$name);
    setcookie ("jl_admin[password]",$name);
    redirect2("admin.php");
}
else {
    show_error(1);
}
?>
## manage.php
<?php
require "func.php";
if (check_admin_password()) {
    switch ($job){
        case "setgood":
            set_good($jl_forum[board],$id);
            break;
        case "setnogood":
            set_no_good($jl_forum[board],$id);
            break;
        case "delete":
            del_doc($jl_forum[board],$id);
            break;
    }
echo "<h2>操作成功!</h2><br>";
?>
<html><head><title>o,k</title></head><body>
<form method="POST">
      <input type="button" value=" 关 闭 " name="B1" onclick="window.close()">
</form>
</body>
</html>
<?php
}
else {
    show_error(1);
}
?>
## manage_list.php
<?php
require("func.php");
if (check_admin_password()) {
$board=$jl_forum[board];
$sql="select * from boardinfo where name='$board'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
$chinesename=$sql_row[chinesename];
setcookie ("jl_forum[chinesename]",$chinesename);
$sql="select name from user where slaveboard='$board'";
$sql_result=mysql_query($sql);
?>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/index.css">
<script language="javascript">
function openwin(board,id){                window.open("manage_read.php?board="+board+"&id="+id,"","height=460,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function post(board){                window.open("post.php?board="+board,"","height=500,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>
</head>

<body bgcolor="#FFFFFF" background="image/bg.gif">
<?php include "header.php";?> <br>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#D8D8E8" bordercolordark="#D8D8E8">
  <tr>  
    <td height="20" width="27%" bgcolor="#d8dde9">版面:<?php
echo $chinesename;
?>(管理)</td>
    <td height="20" width="31%" bgcolor="#d8dde9">版主:<?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo "$sql_row[name]"." ";
}
# 选择出留言纪录;
$sql="select * from $board where slaveid=0";
$temp=mysql_query($sql);
$sum=mysql_num_rows($temp);
$totalpage=ceil($sum/$pagesize);
if ($sum==0) {
    $totalpage=1;
}
# 分页
if($page<1 or empty($page)){
    $page=1;
}
elseif ($page>$totalpage){
         $page=$totalpage;
}
$offset=($page-1)*$pagesize;
$sql="select * from $board where slaveid=0 order by id desc limit $offset,$pagesize";
$sql_result=mysql_query($sql);
?> </td>
    <td height="20" width="15%" bgcolor="#d8dde9">贴子总数:<?php echo $sum; ?></td>
    <td height="20" width="12%"><a href='javascript:post("<?php echo $board;?>")'><img src="image/newtopic.jpg" width="92" height="21" border="0" alt="发新贴子"></a></td>
    <td height="20" align="center" width="15%"><a href="<?php echo "$php_self?board=$board&page=$page";?>">刷新浏览</a></td>
  </tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolorlight="#CCCCCC" bordercolordark="#CCCCCC">
  <tr bgcolor="#995100" align="center">
    <td width="6%"><font color="#FFFFFF">回应</font></td>
    <td width="67%" bgcolor="#995100"><font color="#FFFFFF">主 题</font></td>
    <td width="20%"><font color="#FFFFFF">时 间</font></td>
    <td width="7%"><font color="#FFFFFF">人气</font></td>
  </tr>
  <tr bgcolor="#FFCC99">
    <td colspan="5" height="2"> </td>
  </tr>
  <?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo"<tr>";
echo"<td width="6%" bgcolor="#FFF5DD" align="center">";
if ($sql_row[renum]!=0)
      {
       echo "<font color="#FF0000">[+$sql_row[renum]]</font>";
      }
else
{
echo "[0]";
}
  echo"</td>";
  echo"<td bgcolor="#E8FDEE" width="56%"><font face="宋体"><a href='javascript:openwin("$board",$sql_row[id])' title="作者:$sql_row[writer] 大小:$sql_row[size]字节">$sql_row[title]</a></font></td>";
  echo"<td width="18%" bgcolor="#FFF5DD" align="center">$sql_row[writetime]</td>";
  echo"<td width="6%" bgcolor="#E8FDEE" align="center">$sql_row[hits]</td>";
  echo"</tr>";
}
?>
  <tr bgcolor="#FFCC99">
    <td colspan="5" align="center" height="2"> </td>
  </tr>
</table>
<div align="right">
<form method="post" action="<?php echo $php_self;?>">
    共<b><?php echo $totalpage;?></b>页 第<b><?php echo $page;?></b>页· <?php
if ($page!=1){
     $back=$page-1;
        echo"<a href="$php_self?board=$board&page=1">首页</a> <a href="$php_self?board=$board&page=$back">上一页</a>";
}
if ($page==1){
       echo"首页 上一页";
}
if($page!=$totalpage){
    $next=$page+1;
        echo" <a href="$php_self?board=$board&page=$next">下一页</a> <a href="$php_self?board=$board&page=$totalpage">尾页</a>";
}
if($page==$totalpage){
        echo" 下一页 尾页";
}
?>·转到第  
    <input type="text" name="page" size="2">
    页  
  </form>
</div>
<?php include "footer.php"?>
</body>
</html>
<?php
}
else {
    show_error(4);
}
?> 

PHP 相关文章推荐
php缓存技术介绍
Nov 25 PHP
15种PHP Encoder的比较
Apr 17 PHP
PHP,ASP.JAVA,JAVA代码格式化工具整理
Jun 15 PHP
php算开始时间到过期时间的相隔的天数
Jan 12 PHP
PHP面向接口编程 耦合设计模式 简单范例
Mar 23 PHP
PHP获取当前日期和时间及格式化方法参数
May 11 PHP
PHP框架性能测试报告
May 08 PHP
PHP编程之设置apache虚拟目录
Jul 08 PHP
php使用Jpgraph创建3D饼形图效果示例
Feb 15 PHP
php自定义函数br2nl实现将html中br换行符转换为文本输入中换行符的方法【与函数nl2br功能相反】
Feb 17 PHP
PHP异常类及异常处理操作实例详解
Dec 19 PHP
浅谈PHP进程管理
Mar 08 PHP
基于mysql的论坛(5)
Oct 09 #PHP
基于mysql的论坛(6)
Oct 09 #PHP
生成sessionid和随机密码的例子
Oct 09 #PHP
基于mysql的论坛(7)
Oct 09 #PHP
基于mysql的论坛(3)
Oct 09 #PHP
一个简单的域名注册情况查询程序
Oct 09 #PHP
不用数据库的多用户文件自由上传投票系统(2)
Oct 09 #PHP
You might like
《逃离塔科夫》——“萌新劝退,老手自嗨”的硬核FPS游戏
2020/04/03 其他游戏
PHP+MySQL之Insert Into数据插入用法分析
2015/09/27 PHP
yii的入口文件index.php中为什么会有这两句
2016/08/04 PHP
thinkPHP5框架导出Excel文件简单操作示例
2018/08/03 PHP
jQueryUI写一个调整分类的拖放效果实现代码
2012/05/10 Javascript
javascript中自定义对象的属性方法分享
2013/07/12 Javascript
jquery实现图片裁剪思路及实现
2013/08/16 Javascript
JS中typeof与instanceof之间的区别总结
2013/11/14 Javascript
小米公司JavaScript面试题
2014/12/29 Javascript
js实现iframe自动自适应高度的方法
2015/02/17 Javascript
javascript搜索框效果实现方法
2015/05/14 Javascript
js判断当前页面在移动设备还是在PC端中打开
2016/01/06 Javascript
javascript简单实现跟随滚动条漂浮的返回顶部按钮效果
2016/08/19 Javascript
angular ng-click防止重复提交实例
2017/06/16 Javascript
Angularjs实现下拉框联动的示例代码
2017/08/22 Javascript
使用vs code开发Nodejs程序的使用方法
2017/09/21 NodeJs
vue开发环境配置跨域的方法步骤
2019/01/16 Javascript
详解vue-router导航守卫
2019/01/19 Javascript
VSCode launch.json配置详细教程
2020/06/18 Javascript
[01:04]DOTA2:伟大的Roshan雕塑震撼来临
2015/01/30 DOTA
跟老齐学Python之不要红头文件(2)
2014/09/28 Python
在类Unix系统上开始Python3编程入门
2015/08/20 Python
Python编程实现的图片识别功能示例
2017/08/03 Python
基于python修改srt字幕的时间轴
2020/02/03 Python
美国男士内衣品牌:Tommy John
2017/12/22 全球购物
美国在线自行车商店:Jenson USA
2018/05/22 全球购物
企业管理毕业生求职信范文
2014/03/07 职场文书
干部考核评语
2014/04/29 职场文书
反邪教宣传工作方案
2014/05/07 职场文书
财务部副经理岗位职责范本
2014/06/17 职场文书
售房协议书
2014/08/19 职场文书
安全伴我行演讲稿
2014/09/04 职场文书
财政专业大学生职业生涯规划书
2014/09/17 职场文书
2015年校长新年寄语
2014/12/08 职场文书
小学重阳节活动总结
2015/03/24 职场文书
2016入党培训心得体会范文
2016/01/08 职场文书