⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 board.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");

$PAGE_SIZE=10;
?>

<html>
<head>
<title>讨论区</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script Language="JavaScript">
function set_page()
{
 PAGE_START=(PAGE_NUM.value-1)*<?=$PAGE_SIZE?>+1;
 location="board.php?BOARD_ID=<?=$BOARD_ID?>&PAGE_START="+PAGE_START;
}

</script>
</head>

<body class="bodycolor" topmargin="5">

<?
//------- 讨论区信息 -------
$query = "SELECT * from BBS_BOARD where BOARD_ID=$BOARD_ID";
$cursor = exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
{
   $DEPT_ID = $ROW["DEPT_ID"];
   $BOARD_NAME = $ROW["BOARD_NAME"];
   $WELCOME_TEXT = $ROW["WELCOME_TEXT"];
   $BOARD_HOSTER = $ROW["BOARD_HOSTER"];
   $ANONYMITY_YN = $ROW["ANONYMITY_YN"];

   $BOARD_NAME=str_replace("<","&lt",$BOARD_NAME);
   $BOARD_NAME=str_replace(">","&gt",$BOARD_NAME);
   $BOARD_NAME=stripslashes($BOARD_NAME);

   $WELCOME_TEXT=str_replace("<","&lt",$WELCOME_TEXT);
   $WELCOME_TEXT=str_replace(">","&gt",$WELCOME_TEXT);
   $WELCOME_TEXT=stripslashes($WELCOME_TEXT);
}
 //----------获得版主名称-----------
$BOARD_HOSTER_NAME="";
$TOK=strtok($BOARD_HOSTER,",");
while($TOK!="")
{
   $query1 = "SELECT * from USER where USER_ID='$TOK'";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $BOARD_HOSTER_NAME.=$ROW["USER_NAME"].",";
   $TOK=strtok(",");
}
$BOARD_HOSTER_NAME=substr($BOARD_HOSTER_NAME,0,-1);
//=============================== 查阅文章信息 ===================================
$query = "SELECT count(*) from BBS_COMMENT where BOARD_ID=$BOARD_ID and PARENT=0";
$cursor= exequery($connection,$query);
$COMMENT_COUNT=0;
if($ROW=mysql_fetch_array($cursor))
   $COMMENT_COUNT=$ROW[0];

if($COMMENT_COUNT==0)
{
?>
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/bbs.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><a href="index.php"><span class="big3">讨论区</span></a><span class="big3"> - </span><a href="board.php?BOARD_ID=<?=$BOARD_ID?>"><span class="big3"><?=$BOARD_NAME?></span></a><br>
    </td>
  </tr>
</table>

<table border="0" cellspacing="1" width="95%" class="small" cellpadding="3">
  <tr>
      <td class="small1"><?=$WELCOME_TEXT?></td>
      <td valign="bottom" class="small1">版主:<?=$BOARD_HOSTER_NAME?>&nbsp;
      <td nowrap align="right">
          <input type="button"  value="发帖" class="SmallButton" onClick="location='edit.php?BOARD_ID=<?=$BOARD_ID?>';" title="发表新文章">&nbsp;
          <input type="button"  value="积分榜" class="SmallButton" onClick="location='user_top.php';" title="积分排行榜">&nbsp;
          <input type="button"  value="其它讨论区" class="SmallButton" onClick="location='index.php';" title="返回讨论区目录">
      </td>
  </tr>
</table>

<br>

<?
  Message("","该讨论区尚无文章");
  exit;
}

//============ 存在文章,开始计算分页 =================

//--- 计算总页数 ---
$PAGE_TOTAL=$COMMENT_COUNT/$PAGE_SIZE;
$PAGE_TOTAL=ceil($PAGE_TOTAL);

//--- 计算,末页 ---
if($COMMENT_COUNT<=$PAGE_SIZE)
   $LAST_PAGE_START=1;
else if($COMMENT_COUNT%$PAGE_SIZE==0)
   $LAST_PAGE_START=$COMMENT_COUNT-$PAGE_SIZE+1;
else
   $LAST_PAGE_START=$COMMENT_COUNT-$COMMENT_COUNT%$PAGE_SIZE+1;

//--- 智能分页 ---
//-- 页首 --
if($PAGE_START=="")
   $PAGE_START=1;

if($PAGE_START>$COMMENT_COUNT)
   $PAGE_START=$LAST_PAGE_START;

if($PAGE_START<1)
   $PAGE_START=1;

//-- 页尾 --
$PAGE_END=$PAGE_START+$PAGE_SIZE-1;

if($PAGE_END>$COMMENT_COUNT)
   $PAGE_END=$COMMENT_COUNT;

//--- 计算当前页 ---
$PAGE_NUM=($PAGE_START-1)/$PAGE_SIZE+1;
?>

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/bbs.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><a href="index.php"><span class="big3">讨论区</span></a><span class="big3"> - </span><a href="board.php?BOARD_ID=<?=$BOARD_ID?>"><span class="big3"><?=$BOARD_NAME?></span></a><br>
    </td>
    <td valign="bottom" class="small1">共<span class="big4">&nbsp;<?=$COMMENT_COUNT?></span>&nbsp;篇文章
    </td>
    <td valign="bottom" class="small1">
    当前为第<b><?=$PAGE_START?></b>至<b><?=$PAGE_END?></b>篇 (第<?=$PAGE_NUM?>页,共<?=$PAGE_TOTAL?>页,每页最多<?=$PAGE_SIZE?>篇)</font>
    </td>
    </tr>
</table>

<table border="0" cellspacing="1" width="95%" class="small" cellpadding="3">
  <tr>
      <td class="small1"><?=$WELCOME_TEXT?></font></td>
      <td valign="bottom" class="small1">版主:<?=$BOARD_HOSTER_NAME?>&nbsp;
      </td>
      <td nowrap align="right">
          <input type="button"  value="发帖" class="SmallButton" onClick="location='edit.php?BOARD_ID=<?=$BOARD_ID?>';" title="发表新文章">&nbsp;
          <input type="button"  value="搜索" class="SmallButton" onClick="location='query.php?BOARD_ID=<?=$BOARD_ID?>';" title="搜索文章">&nbsp;
          <input type="button"  value="热门文章" class="SmallButton" onClick="location='comment_top.php?BOARD_ID=<?=$BOARD_ID?>';" title="热门文章">&nbsp;
          <input type="button"  value="积分榜" class="SmallButton" onClick="location='user_top.php';" title="积分排行榜">&nbsp;
          <input type="button"  value="其它讨论区" class="SmallButton" onClick="location='index.php';" title="返回讨论区目录">
      </td>
  </tr>
</table>

<table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">
  <tr class="TableHeader">
      <td nowrap align="center">作者</td>
<?
if($LOGIN_USER_PRIV==1 || find_id($BOARD_HOSTER,$LOGIN_USER_ID))
{
?>
      <td nowrap align="center">实名</td>
<?
}
?>
      <td nowrap align="center">标题</td>
      <td nowrap align="center">字节</td>
      <td nowrap align="center">阅</td>
      <td nowrap align="center">回</td>
      <td align="center">发表时间 <img border=0 src="/images/arrow_down.gif" width="11" height="10"></td>
      <td nowrap align="center">操作</td>
  </tr>

<?
$query = "SELECT * from BBS_COMMENT where BOARD_ID=$BOARD_ID and PARENT=0 order by SUBMIT_TIME desc";
$cursor = exequery($connection, $query);

$COMMENT_COUNT = 0;
while($ROW=mysql_fetch_array($cursor))
{
  $COMMENT_COUNT++;

  if($COMMENT_COUNT<$PAGE_START)
     continue;
  else if($COMMENT_COUNT>$PAGE_END)
     break;

  $COMMENT_ID = $ROW["COMMENT_ID"];
  $USER_ID = $ROW["USER_ID"];
  $AUTHOR_NAME = $ROW["AUTHOR_NAME"];
  $SUBJECT = $ROW["SUBJECT"];
  $SUBMIT_TIME = $ROW["SUBMIT_TIME"];
  $OLD_SUBMIT_TIME = $ROW["OLD_SUBMIT_TIME"];
  if($OLD_SUBMIT_TIME=="0000-00-00 00:00:00")
     $OLD_SUBMIT_TIME=$SUBMIT_TIME;
  $READ_CONT = $ROW["READ_CONT"];
  $REPLY_CONT = $ROW["REPLY_CONT"];

  $CONTENT=$ROW["CONTENT"];
  $CONTENT_SIZE=strlen($CONTENT);
  $CONTENT_SIZE=number_format($CONTENT_SIZE,0, ".",",");

  $AUTHOR_NAME=str_replace("<","&lt",$AUTHOR_NAME);
  $AUTHOR_NAME=str_replace(">","&gt",$AUTHOR_NAME);
  $AUTHOR_NAME=stripslashes($AUTHOR_NAME);

  $SUBJECT=str_replace("<","&lt",$SUBJECT);
  $SUBJECT=str_replace(">","&gt",$SUBJECT);
  $SUBJECT=stripslashes($SUBJECT);

  $query1 = "SELECT * from USER where USER_ID='$USER_ID'";
  $cursor1= exequery($connection,$query1);
  if($ROW=mysql_fetch_array($cursor1))
  {
     $AVATAR=$ROW["AVATAR"];
     $USER_NAME=$ROW["USER_NAME"];
  }
  else
  {
     $USER_NAME=$USER_ID;
     $AVATAR="";
  }

  if($COMMENT_COUNT%2==1)
     $TableLine="TableLine1";
  else
     $TableLine="TableLine2";
?>
  <tr class="<?=$TableLine?>">
    <td width="90" nowrap>
<?
  if($USER_NAME==$AUTHOR_NAME)
  {
?>
    <img src="/images/avatar/<?=$AVATAR?>.gif" <?=avatar_size($AVATAR)?> align="absmiddle">
<?
  }

  if($ANONYMITY_YN==0  && $USER_NAME!=$AUTHOR_NAME)
  {
?>
    <?=$USER_NAME?></td>
<?
  }
  else
  {
?>
    <?=$AUTHOR_NAME?></td>
<?
  }

if($LOGIN_USER_PRIV==1 || find_id($BOARD_HOSTER,$LOGIN_USER_ID))
{
?>
     <td align="center" width="60" nowrap><?=$USER_NAME?></td>
<?
}
?>
      <td><a href="comment.php?BOARD_ID=<?=$BOARD_ID?>&COMMENT_ID=<?=$COMMENT_ID?>&PAGE_START=<?=$PAGE_START?>"><?=$SUBJECT?></a></td>
      <td align="center" width="30" nowrap><?=$CONTENT_SIZE?></td>
      <td align="center" width="10" nowrap><?=$READ_CONT?></td>
      <td align="center" width="10" nowrap><?=$REPLY_CONT?></td>
      <td align="center" width="130" nowrap><?=$OLD_SUBMIT_TIME?></td>
      <td align="center" width="120" nowrap>
<?
      if($USER_ID==$LOGIN_USER_ID || $LOGIN_USER_PRIV==1 || find_id($BOARD_HOSTER,$LOGIN_USER_ID))
      {
?>
         <a href="javascript:;" onClick="window.open('move.php?BOARD_ID=<?=$BOARD_ID?>&COMMENT_ID=<?=$COMMENT_ID?>','','height=200,width=250,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,left=350,top=150,resizable=yes');">转移</a>&nbsp;
         <a href="edit.php?BOARD_ID=<?=$BOARD_ID?>&COMMENT_ID=<?=$COMMENT_ID?>&PAGE_START=<?=$PAGE_START?>">编辑</a>&nbsp;
         <a href="javascript:delete_comment(<?=$COMMENT_ID?>);">删除</a>
<?
      }
?>
      </td>
  </tr>

<?
}//while

if($COMMENT_COUNT>0)
{
?>
  <tr class="TableControl">
  <td colspan="8" align="right">
     <input type="button"  value="首页" class="SmallButton"  <?if($PAGE_START==1)echo "disabled";?> onclick="location='board.php?BOARD_ID=<?=$BOARD_ID?>'"> &nbsp;&nbsp;
     <input type="button"  value="上一页" class="SmallButton" <?if($PAGE_START==1)echo "disabled";?> onclick="location='board.php?BOARD_ID=<?=$BOARD_ID?>&PAGE_START=<?=($PAGE_START-$PAGE_SIZE)?>'"> &nbsp;&nbsp;
     <input type="button"  value="下一页" class="SmallButton" <?if($PAGE_END>=$COMMENT_COUNT)echo "disabled";?> onclick="location='board.php?BOARD_ID=<?=$BOARD_ID?>&PAGE_START=<?=($PAGE_END+1)?>'"> &nbsp;&nbsp;
     <input type="button"  value="末页" class="SmallButton"  <?if($PAGE_END>=$COMMENT_COUNT)echo "disabled";?> onclick="location='board.php?BOARD_ID=<?=$BOARD_ID?>&PAGE_START=<?=$LAST_PAGE_START?>'"> &nbsp;&nbsp;
     页数
     <input type="text" name="PAGE_NUM" value="<?=$PAGE_NUM?>" class="SmallInput" size="2"> <input type="button"  value="转到" class="SmallButton" onclick="set_page();" title="转到指定的页面">&nbsp;&nbsp;
  </td>
  </tr>
</table>
<?
}
?>

<script>
function delete_comment(COMMENT_ID)
{
  msg="确定要删除该文章吗?";
  if(window.confirm(msg))
  {
    URL="delete.php?BOARD_ID=<?=$BOARD_ID?>&PAGE_START=<?=$PAGE_START?>&COMMENT_ID=" + COMMENT_ID;
    window.location=URL;
  }
}
</script>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -