您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
基于mysql的论坛(3)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:35:28
    <td>
      <form method="post" action="good_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="submit" name="Submit" 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>
###########################
# good_list.php ###########
###########################
<?php
require("func.php");
if(!is_board_exits($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("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="#eeeeee">版面:<?php
echo $chinesename;
?>精华区</td>
    <td height="20" width="34%" bgcolor="#eeeeee">版主:<?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo "$sql_row[name]"."&nbsp;";
}
# 选择出留言纪录;
$sql="select * from $board where good='y'";
$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 good='y' order by id desc limit $offset,$pagesize";
$sql_result=mysql_query($sql);
?> </td>
    <td height="20" width="15%" bgcolor="#eeeeee">共有<?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="17%"><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="#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">&nbsp;</td>
  </tr>
  <?php
while ($sql_row=mysql_fetch_array($sql_result))
{
echo"<tr>";
echo"<td width="6%" bgcolor="#FFF5DD" 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">&nbsp;</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>
############################
###  good_read.php ######
######################3
<?php
require ("func.php");
if ($re){
     if (!is_board_exits($board)){
          show_error(7);
          $founderr=1;
     }
     $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)){
        

上一页  [1] [2] [3] [4] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
  • 上一篇文章:
  • 下一篇文章:
  • 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |