基于mysql的论坛(6)


Posted in PHP onOctober 09, 2006

# post.php
<?php
require("config.inc.php");
$sql="select * from boardinfo where name='$board'";
$sql_result=mysql_query($sql);
$sql_row=mysql_fetch_array($sql_result);
?>
<html>
<head>
<title>发新贴子</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body bgcolor="#666666">
<?php include "ad.php";?><br>
<hr noshade width="80%" size="1">
<table width="80%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#686898" bordercolordark="#FFFFFF">
  <tr align="center" valign="top" bgcolor="#666699">  
    <td><font size="3" color="#336699"><b><font color="#CCFFFF">发 贴 子</font></b></font><br>
    </td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td>(您<b>必须注册</b>以后才能发表新主题,不然您只能查看主题。<br>
      如果您还未注册,请<a href="apply.php" target="_blank"><font color="#FF0000">点击这里</font></a>转到注册页)</td>
  </tr>
  <tr bgcolor="#e8eee0">  
    <td><br>
      您的贴子将被发表在<b><?php echo $sql_row[chinesename];?></b>版块 </td>
  </tr>
</table>
<br>
<form method="post" action="read.php">
  <table width="98%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#336699" bordercolordark="#FFFFFF" bgcolor="#666699">
    <tr>  
      <td width="89" bgcolor="#acc0fa" align="right">用户名:</td>
      <td width="224">  
        <input type="text" name="name" style="font-size: 9pt; background-color: #FFFFFF; color: #3366FF; border: 1 solid #000000" value="<?php echo $jl_forum[name];?>" size="17" maxlength="16">
        <font color="#FF0000">* </font> </td>
      <td width="63" bgcolor="#acc0fa" align="right">密码:</td>
      <td width="160">  
        <input type="password" name="password" size="10" maxlength="16" style="font-size: 9pt; background-color: #FFFFFF; color: #FF0000; border: 1 solid #000000">
        <font color="#FF0000">*</font> <font color="#FF0000"> </font> </td>
    </tr>
    <tr>  
      <td colspan="4"><font color="#FFFFFF">主题:</font>  
        <input type="text" name="title" size="50" maxlength="50" style="font-size: 9pt; background-color: #FFFFFF; color: ##3366FF; border: 1 solid #000000">
        <font color="#FF0000">* </font></td>
    </tr>
    <tr>  
      <td colspan="4"> <font color="#FFFFFF">内容:</font><br>
        

   
        <textarea name="cont" cols="70" rows="12" wrap="VIRTUAL"></textarea>
        <br>
        <input type="button" name="Submit2" value="取消" onclick="window.close()">
        <input type="submit" name="add" value="提交">
        <input type="checkbox" name="qm" value="qm" checked>
        <font color="#FFFFFF">使用签名</font>  
        <input type="hidden" name="board" value="<?php echo $board;?>">
      </td>
    </tr>
  </table>
  </form>
<?php include "footer.php";?><br>
</body>
</html>
# query.php
<?php
    require("func.php");
    $sql="select * from boardinfo";
    $sql_result=mysql_query($sql);
?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/page.css">
</head>

<body bgcolor="#FFFFFF" background="image/bg.gif">
<table width="90%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#FFCC99" bordercolordark="#FFCC99">
  <tr bgcolor="#CCFF99">  
    <td>
      <div align="center"><b>论坛贴子查询</b></div>
    </td>
  </tr>
  <tr align="center">  
    <td>
      <form method="post" action="query_list.php">
        在  
        <select name="board">
          <option selected>请选择版面</option>
<?php
while($sql_row=mysql_fetch_array($sql_result)){
?>  
          <option value="<?php echo $sql_row[name];?>"><?php echo $sql_row[chinesename];?></option>
<?php
}
?>
        </select>
        中查询<br>
        <input type="text" name="query_str" size="40" maxlength="40">
        <br>
        <input type="submit" name="title" value="按主题查询">
        <input type="submit" name="cont" value="按内容查询">
        <input type="submit" name="writer" value="按作者查询">
      </form>
    </td>
  </tr>
  <tr bgcolor="#CCFF99">  
    <td>
      <div align="center"><b>论坛信息</b></div>
    </td>
  </tr>
  <tr>
    <td>
<?php include "info.php";?>
    </td>
  </tr>
</table>
</body>
</html>
# query_list.php
<?php
require("func.php");
if (!empty($query_str)) {

if(!is_board_exits($board)){
    $board="computer";
}
if ($title){
    $submit="title";
}
elseif ($cont) {
    $submit="cont";
}
elseif ($writer) {
    $submit="writer";
}
else {
    $submit="title";
}
$sql="select * from $board where ($submit like '%$query_str%')";
$temp=mysql_query($sql);
$sum=mysql_num_rows($temp);
if ($sum!=0) {
$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("good_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="20" width="22%" bgcolor="#E8E8E8">版面:<?php
echo $chinesename;
?></td>
    <td height="20" width="29%" bgcolor="#E8E8E8">版主:<?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo "$sql_row[name]"." ";
}
# 选择出留言纪录;

$totalpage=ceil($sum/$pagesize);
# 分页
if($page<1 or empty($page)){
    $page=1;
}
elseif ($page>$totalpage){
         $page=$totalpage;
}
elseif ($totalpage==0) {
    $page=0;
}
$offset=($page-1)*$pagesize;
$sql="select * from $board where ($submit like '%$query_str%') order by id desc limit $offset,$pagesize";
$sql_result=mysql_query($sql);
?> </td>
    <td height="20" width="17%" bgcolor="#E8E8E8">查询到<?php echo $sum; ?>条纪录</td>
    <td height="20" colspan="2" width="32%"><a href='javascript:post("<?php echo $board;?>")'><img src="image/newtopic.jpg" width="92" height="21" border="0" alt="发新贴子"></a></td>
  </tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolorlight="#CCCCCC" bordercolordark="#eeeeee">
  <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="#E8E8E8" align="center">";
echo "[*]";
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;?>">
    <input type="hidden" name="<?php echo $submit;?>" value="y">
    <input type="hidden" name="query_str" value="<?php echo $query_str;?>">
    共<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&$submit=y&query_str=$query_str">首页</a> <a href="$php_self?board=$board&page=$back&$submit=y&query_str=$query_str">上一页</a>";
}
if ($page==1){
       echo"首页 上一页";
}
if($page!=$totalpage){
    $next=$page+1;
        echo" <a href="$php_self?board=$board&page=$next&$submit=y&query_str=$query_str">下一页</a> <a href="$php_self?board=$board&page=$totalpage&$submit=y&query_str=$query_str">尾页</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>
<?php
}
else
    {
    show_error(10);
}
}
else {
    show_error(9);
}
# read.php
<?php
require ("func.php");
if ($re){
     $sql="select slaveid from $board where id=$id";
     $sql_result=mysql_query($sql);
     $sql_row=mysql_fetch_array($sql_result);
     if($sql_row[slaveid]!=0){
         show_error(1);
         $founderr=1;
     }
     if (!check_user_password($name,$password)){
          show_error(4);
          $founderr=1;
     }
     if (empty($title)){
         show_error(2);
         $founderr=1;
     }
     if ($qm){
          $qm=expl_qm($name);
     }
     if(!$founderr){
         re_doc($board,$id);
         setcookie ("jl_forum[name]",$name);
         $sql="select * from $board where id=$id";
         $sql_result=mysql_query($sql);
         $sql_row=mysql_fetch_array($sql_result);
         $title=$sql_row[title];
         $writer=$sql_row[writer];
         $cont=$sql_row[cont];
         $writetime=$sql_row[writetime];
         $hits=$sql_row[$hits];
         $fromip=$sql_row[fromip];
         $sql="select * from $board where slaveid=$id";
         $sql_result=mysql_query($sql);
        # $sql_row=mysql_fetch_array($sql_result);
     }

}
elseif ($add){
     if (!is_board_exits($board)){
          show_error(7);
          $founderr=1;
     }
     if (empty($title)){
         show_error(2);
         $founderr=1;
     }
     if (!check_user_password($name,$password)){
          show_error(4);
          $founderr=1;
     }
     if ($qm){
          $qm=expl_qm($name);
     }
     if (!$founderr){
           add_doc($board);
           $add=1;
           setcookie ("jl_forum[name]",$name);
     }
}
else {
     if (!is_board_exits){
          show_error(7);
     }
     add_one_hit($board,$id);
     $sql="select * from $board where id=$id";
     $sql_result=mysql_query($sql);
     $sql_row=mysql_fetch_array($sql_result);
     $title=$sql_row[title];
     $writer=$sql_row[writer];
     $cont=$sql_row[cont];
     $writetime=$sql_row[writetime];
     $hits=$sql_row[$hits];
     $fromip=$sql_row[fromip];
     $sql="select * from $board where slaveid=$id";
     $sql_result=mysql_query($sql);
  #   $sql_row=mysql_fetch_array($sql_result);
}
?>
<html>
<head>
<title><?php echo $title;?></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 sendmsg(name){                window.open("sendmsg.php?name="+name,"","height=200,width=500,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
</script>

</head>

<body bgcolor="#666699">
<?php include "ad.php";?><br>
<hr noshade width="98%" size="1">
<table width="98%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr bgcolor="#666666">
    <td><font color="#FFcc00"><b>标题:<?php echo $title;?></b></font></td>
  </tr>
  <tr>
    <td bgcolor="#eeeeee">作者:<?php echo "$writer";?>(<?php echo $writetime;?>) <a href="javascript:sendmsg('<?php echo "$writer";?>')"><img src="image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="userinfo.php?name=<?php echo $writer;?>"><img src="image/profile.gif" width="16" height="15" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td><?php echo $cont;?></td>
  </tr>
  <tr bgcolor="#e8eee0">
    <td>※ 来源:<?php echo $jl_forum[chinesename];?> [◆FROM:<?php echo $fromip;?>]</td>
  </tr>
</table>
<br>
<?php
if ($add!=1){
while($sql_row=mysql_fetch_array($sql_result)) {
?>
<table width="98%" border="1" cellspacing="0" cellpadding="2" align="center" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr bgcolor="#015C71">
    <td><font color="#ffffff">标题:<?php echo $sql_row[title];?></font></td>
  </tr>
  <tr bgcolor="#eeeeee">
    <td>作者:<?php echo "$sql_row[writer]";?>(<?php echo $sql_row[writetime];?>) <a href="javascript:sendmsg('<?php echo "$sql_row[writer]";?>')"><img src="image/icon1.gif" width="18" height="17" alt="给作者留言" border="0"></a> <a href="userinfo.php?name=<?php echo "$sql_row[writer]";?>"><img src="image/profile.gif" width="17" height="15" alt="察看用户资料" border="0"></a></td>
  </tr>
  <tr bgcolor="#ffffef">  
    <td><?php echo $sql_row[cont];?></td>
  </tr>
  <tr bgcolor="#e8eee0">
    <td>※ 来源:<?php echo $jl_forum[chinesename];?> [◆FROM:<?php echo $sql_row[fromip];?>]</td>
  </tr>
</table>
<?php
}
?>
<form method="post" action="read.php">
  <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
      <td>
        <table width="40" border="1" cellspacing="0" cellpadding="0" height="20" bordercolorlight="#000099" bordercolordark="#FFFFFF">
          <tr valign="middle" align="center" bgcolor="#acc0fa">
            <td height="17">回复</td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <table width="98%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#686898" bordercolordark="#CCCCCC">
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">用户名</td>
      <td width="33%">
        <input type="text" name="name" size="17" maxlength="16" value="<?php echo "$jl_forum[name]";?>">
        <font color="#FFFFFF">* </font></td>
      <td width="7%" bgcolor="#acc0fa" align="center">密码</td>
      <td width="52%">
        <input type="password" name="password" size="17" maxlength="16">
        <font color="#FFFFFF">* </font></td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">标题:</td>
      <td colspan="3">
        <input type="text" name="title" size="40" maxlength="50">
        <font color="#FFFFFF"> * </font></td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa">内容:</td>
      <td colspan="3">
        <textarea name="cont" cols="60" rows="3" wrap="VIRTUAL"></textarea>
      </td>
    </tr>
    <tr>
      <td width="8%" align="right" bgcolor="#acc0fa"> </td>
      <td colspan="3">
        <input type="button" name="clear" value="关闭窗口" onclick="window.close()">
        <input type="submit" name="re" value="提交">
        <input type="checkbox" name="qm" value="qm" checked>
        <font color="#FFFFFF">使用签名
        <input type="hidden" name="board" value="<?php echo $board;?>">
        <input type="hidden" name="id" value="<?php echo $id;?>">
        </font></td>
    </tr>
  </table>
  <?php
  }
  ?>
  <br>
</form>
<?php include"footer.php";?><br>
</body>
</html> 

PHP 相关文章推荐
php图片上传存储源码并且可以预览
Aug 26 PHP
php 数组动态添加实现代码(最土团购系统的价格排序)
Dec 30 PHP
php预定义变量使用帮助(带实例)
Oct 30 PHP
php实现的Timer页面运行时间监测类
Sep 24 PHP
项目中应用Redis+Php的场景
May 22 PHP
smarty的section嵌套循环用法示例
May 28 PHP
PHP微信开发之有道翻译
Jun 23 PHP
PHP-FPM的配置与优化讲解
Mar 15 PHP
PHP+Apache实现二级域名之间共享cookie的方法
Jul 24 PHP
自定义Laravel (monolog)日志位置,并增加请求ID的实现
Oct 17 PHP
php利用ZipArchive类操作文件的实例
Jan 21 PHP
YII2框架中查询生成器Query()的使用方法示例
Mar 18 PHP
生成sessionid和随机密码的例子
Oct 09 #PHP
基于mysql的论坛(7)
Oct 09 #PHP
基于mysql的论坛(3)
Oct 09 #PHP
一个简单的域名注册情况查询程序
Oct 09 #PHP
不用数据库的多用户文件自由上传投票系统(2)
Oct 09 #PHP
PHP4实际应用经验篇(4)
Oct 09 #PHP
Php做的端口嗅探器--可以指定网站和端口
Oct 09 #PHP
You might like
PHP编程中八种常见的文件操作方式
2006/11/19 PHP
php实现图片添加水印功能
2014/02/13 PHP
Yii框架关联查询with用法分析
2014/12/02 PHP
PHP常见字符串处理函数用法示例【转换,转义,截取,比较,查找,反转,切割】
2016/12/24 PHP
PHP大文件分片上传的实现方法
2018/10/28 PHP
javascript编程起步(第二课)
2007/01/10 Javascript
理解JAVASCRIPT中hasOwnProperty()的作用
2013/06/05 Javascript
图片上传判断及预览脚本的效果实例
2013/08/07 Javascript
基于jQuery实现select下拉选择可输入附源码下载
2016/02/03 Javascript
什么是JavaScript中的结果值?
2016/10/08 Javascript
js+css3制作时钟特效
2016/10/16 Javascript
菊花转动的jquery加载动画效果
2018/08/19 jQuery
使用vue点击li,获取当前点击li父辈元素的属性值方法
2018/09/12 Javascript
vue单页缓存存在的问题及解决方案(小结)
2018/09/25 Javascript
Vue中的vue-resource示例详解
2018/11/02 Javascript
史上最为详细的javascript继承(推荐)
2019/05/18 Javascript
Webpack中loader打包各种文件的方法实例
2019/09/03 Javascript
nodejs环境使用Typeorm连接查询Oracle数据
2019/12/05 NodeJs
记录一次websocket封装的过程
2020/11/23 Javascript
[02:07]DOTA2超级联赛专访BBC:难忘网吧超神经历
2013/06/09 DOTA
python采用getopt解析命令行输入参数实例
2014/09/30 Python
python中列表和元组的区别
2017/12/18 Python
python+matplotlib实现动态绘制图片实例代码(交互式绘图)
2018/01/20 Python
pycharm远程开发项目的实现步骤
2019/01/20 Python
python的命名规则知识点总结
2019/10/04 Python
PyCharm安装PyQt5及其工具(Qt Designer、PyUIC、PyRcc)的步骤详解
2020/11/02 Python
基于CSS3实现的黑色个性导航菜单效果
2015/09/14 HTML / CSS
Canvas globalCompositeOperation
2018/12/18 HTML / CSS
西班牙英格列斯百货法国官网:El Corte Inglés法国
2017/07/09 全球购物
销售文员的岗位职责
2013/11/20 职场文书
内业资料员岗位职责
2014/01/04 职场文书
2014年小学植树节活动方案
2014/03/02 职场文书
舌尖上的中国观后感
2015/06/02 职场文书
大学班长竞选稿
2015/11/20 职场文书
《围炉夜话》110句人生箴言,精辟有内涵,引人深思
2019/10/23 职场文书
Windows 11要来了?微软文档揭示Win11太阳谷 / Win10有两个不同版本
2021/11/21 数码科技