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

📄 re_news.php

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

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

</head>
<script>
function CheckForm()
{
   if(document.form1.CONTENT.value=="")
   { alert("评论的内容不能为空!");
     return (false);
   }
   
   if(document.all("AUTHOR_NAME").length >1 && document.all("AUTHOR_NAME").item(1).checked && document.form1.NICK_NAME.value=="")
   { alert("昵称不能为空!");
     return (false);
   }
   
   return (true);
}
</script>
<body class="bodycolor" topmargin="5">

<?
 $query = "SELECT * from NEWS where NEWS_ID=$NEWS_ID";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
 {
    $SUBJECT=$ROW["SUBJECT"];
    $ANONYMITY_YN=$ROW["ANONYMITY_YN"];
 }
 
 $query = "SELECT * from USER where USER_ID='$LOGIN_USER_ID'";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
 {
    $LOGIN_USER_NAME=$ROW["USER_NAME"];
    $LOGIN_NICK_NAME=$ROW["NICK_NAME"];
 }
?>
<table width=100% border=0 cellspacing=0 cellpadding=0>
  <tr height="40">
    <td align=center><span class="big3">原文 </span><a href="read_news.php?NEWS_ID=<?=$NEWS_ID?>" style="TEXT-DECORATION:underline"><span class="big3"><?=$SUBJECT?></span></a></span></td>
  </tr>
</table>

<?
 $query = "SELECT count(*) from NEWS_COMMENT where NEWS_ID=$NEWS_ID";
 $cursor= exequery($connection,$query);
 $COMMENT_COUNT=0;
 if($ROW=mysql_fetch_array($cursor))
    $COMMENT_COUNT=$ROW[0];

 if($COMMENT_COUNT==0)
 {
   Message("","暂无评论");
?>
<form action="submit.php"  method="post" name="form1" onsubmit="return CheckForm();">
  <table border="0" width="95%" cellpadding="2" cellspacing="1" align="center" bgcolor="#000000" class="small">
     <tr>
      <td class="TableHeader" colspan="2">
        <img src="/images/green_arrow.gif"> 发表评论:
      </td>
    </tr>
    <tr>
      <td align="center" class="TableData">内容:</td>
      <td class="TableData">
        <textarea cols="57" name="CONTENT" rows="5" class="BigInput" wrap="on"></textarea>
      </td>
    </tr>
    <tr>
      <td align="center" class="TableData">署名:</td>
      <td class="TableData">
        <input type="radio" name="AUTHOR_NAME" value="USER_ID" <? if($ANONYMITY_YN=="0")echo "checked";?>>
        <input type="text"  name="USER_NAME" size="10" maxlength="25" class="BigStatic" value="<?=$LOGIN_USER_NAME?>" readonly>
<?
        if($ANONYMITY_YN=="1")
        {
?>
        <input type="radio" name="AUTHOR_NAME" value="NICK_NAME" checked>昵称
        <input type="text" name="NICK_NAME" size="10" maxlength="25" class="BigInput" value="<?=$LOGIN_NICK_NAME?>">
<?
        }
?>
      </td>
    </tr>
    <tr align="center" class="TableControl">
      <td nowrap colspan="2">
        <input type="hidden" value="<?=$NEWS_ID?>" name="NEWS_ID">
        <input type="hidden" value="<?=$MANAGE?>" name="MANAGE">
        <input type="submit" value="发表" class="BigButton">&nbsp;&nbsp;
        <input type="button" value="关闭" class="BigButton" onClick="javascript:window.close();">
      </td>
    </tr>
  </table>
</form>
<?
   exit;
 }

 $PER_PAGE=10;
 $PAGES=10;
 $PAGE_COUNT=ceil($COMMENT_COUNT/$PER_PAGE);

 if($CUR_PAGE<=0 || $CUR_PAGE=="")
    $CUR_PAGE=1;
 if($CUR_PAGE>$PAGE_COUNT)
    $CUR_PAGE=$PAGE_COUNT;
?>
<table width=95% border=0 cellspacing=0 cellpadding=2 align="center" class="small">
  <tr class="TableHeader">
    <td>&nbsp;&nbsp;相关评论 <?=$COMMENT_COUNT?> 条</td>
    <td align="right">
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">首页</a>&nbsp;
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$PAGE_COUNT?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">末页</a>&nbsp;&nbsp;
<?
if($CUR_PAGE%$PAGES==0)
   $J=$PAGES;
else
   $J=$CUR_PAGE%$PAGES;

if($CUR_PAGE> $PAGES)
{
?>
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$CUR_PAGE-$J-$PAGES+1?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">上<?=$PAGES?>页</a>&nbsp;&nbsp;
<?
}

for($I=$CUR_PAGE-$J+1;$I<=$CUR_PAGE-$J+$PAGES;$I++)
{
   if($I>$PAGE_COUNT)
      break;

   if($I==$CUR_PAGE)
   {
?>
       [<?=$I?>]&nbsp;
<?
   }
   else
   {
?>
       [<a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$I?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline"><?=$I?></a>]&nbsp;
<?
   }
}
?>
      &nbsp;
<?
if($I-1< $PAGE_COUNT)
{
?>
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$I?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">下<?=$PAGES?>页</a>&nbsp;&nbsp;
<?
}
if($CUR_PAGE-1>=1)
{
?>
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$CUR_PAGE-1?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">上一页</a>&nbsp;
<?
}
else
{
?>
       上一页&nbsp;
<?
}

if($CUR_PAGE+1<= $PAGE_COUNT)
{
?>
       <a href="re_news.php?NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$CUR_PAGE+1?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">下一页</a>&nbsp;
<?
}
else
{
?>
       下一页&nbsp;
<?
}
?>
       &nbsp;
    </td>
  </tr>
</table>

 <table border="0" width="95%" cellpadding="2" cellspacing="0" align="center" bgcolor="#1C599F" class="small">

<?
 $COUNT=0;
 $query = "SELECT * from NEWS_COMMENT where NEWS_ID=$NEWS_ID order by RE_TIME desc";
 $cursor= exequery($connection,$query);
 while($ROW=mysql_fetch_array($cursor))
 {
    $COUNT++;
    if($COUNT<$CUR_PAGE*$PER_PAGE-$PER_PAGE+1)
       continue;
    if($COUNT>$CUR_PAGE*$PER_PAGE)
       break;

    $COMMENT_ID=$ROW["COMMENT_ID"];
    $PARENT_ID=$ROW["PARENT_ID"];
    $CONTENT=$ROW["CONTENT"];
    $RE_TIME=$ROW["RE_TIME"];
    $USER_ID=$ROW["USER_ID"];
    $NICK_NAME=$ROW["NICK_NAME"];

    $CONTENT=str_replace("<","&lt",$CONTENT);
    $CONTENT=str_replace(">","&gt",$CONTENT);
    $CONTENT=stripslashes($CONTENT);
    $CONTENT=str_replace("\n","<br>",$CONTENT);
        
    $USER_NAME="";
    if($ANONYMITY_YN=="0" || $NICK_NAME=="")
    {
       $query = "SELECT * from USER where USER_ID='$USER_ID'";
       $cursor1= exequery($connection,$query);
       if($ROW1=mysql_fetch_array($cursor1))
       {
          $DEPT_ID=$ROW1["DEPT_ID"];
          $DEPT_NAME=dept_long_name($DEPT_ID);
          $USER_NAME="<u title=\"部门:".$DEPT_NAME."\" style=\"cursor:hand\">".$ROW1["USER_NAME"]."</u>";
       }
    }
    else
    {
       $USER_NAME=$NICK_NAME;
    }

    $query = "SELECT * from NEWS_COMMENT where COMMENT_ID=$PARENT_ID";
    $cursor1= exequery($connection,$query);
    if($ROW1=mysql_fetch_array($cursor1))
    {
       $CONTENT1=$ROW1["CONTENT"];
       $CONTENT1=str_replace("<","&lt",$CONTENT1);
       $CONTENT1=str_replace(">","&gt",$CONTENT1);
       $CONTENT1=stripslashes($CONTENT1);
       $CONTENT1=str_replace("\n","<br>",$CONTENT1);
    }

    $query = "SELECT count(*) from NEWS_COMMENT where PARENT_ID=$COMMENT_ID";
    $cursor1= exequery($connection,$query);
    if($ROW1=mysql_fetch_array($cursor1))
       $RELAY_COUNT=$ROW1[0];
?>
        <tr heught="1">
         <td bgcolor=black></td>
        </tr>
          <tr>
            <td class="TableHeader">
              &nbsp;&nbsp;<?=$USER_NAME?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发表时间:<?=$RE_TIME?>
            </td>
          </tr>
          <tr height="40">
            <td class="TableData">
              <?=$CONTENT?>
<?
if($PARENT_ID!=0)
{
?>
              <br><hr width="95%">
              <b>[原贴]</b><br>
              <?=$CONTENT1?>
<?
}
?>
            </td>
          </tr>
          <tr>
            <td class="TableControl" align="right">
              <a href="relay.php?COMMENT_ID=<?=$COMMENT_ID?>&NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$CUR_PAGE?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">回复本贴</a>&nbsp;&nbsp;&nbsp;
<?
if(find_id($LOGIN_FUNC_STR,"105") || $USER_ID==$LOGIN_USER_ID)
{
?>
              <a href="delete.php?COMMENT_ID=<?=$COMMENT_ID?>&NEWS_ID=<?=$NEWS_ID?>&CUR_PAGE=<?=$CUR_PAGE?>&MANAGE=<?=$MANAGE?>" style="text-decoration:underline">删除</a>&nbsp;&nbsp;&nbsp;
<?
}
?>
              回复数:<?=$RELAY_COUNT?>&nbsp;&nbsp;
          </td>
        </tr>
<?
}
?>

  </table>

<form action="submit.php"  method="post" name="form1" onsubmit="return CheckForm();">
  <table border="0" width="95%" cellpadding="2" cellspacing="1" align="center" bgcolor="#000000" class="small">
     <tr>
      <td class="TableHeader" colspan="2">
        <img src="/images/green_arrow.gif"> 发表评论:
      </td>
    </tr>
    <tr>
      <td align="center" class="TableData">内容:</td>
      <td class="TableData">
        <textarea cols="57" name="CONTENT" rows="5" class="BigInput" wrap="on"></textarea>
      </td>
    </tr>
    <tr>
      <td align="center" class="TableData">署名:</td>
      <td class="TableData">
        <input type="radio" name="AUTHOR_NAME" value="USER_ID" <? if($ANONYMITY_YN=="0")echo "checked";?>>
        <input type="text"  name="USER_NAME" size="10" maxlength="25" class="BigStatic" value="<?=$LOGIN_USER_NAME?>" readonly>
<?
        if($ANONYMITY_YN=="1")
        {
?>
        <input type="radio" name="AUTHOR_NAME" value="NICK_NAME" checked>昵称
        <input type="text" name="NICK_NAME" size="10" maxlength="25" class="BigInput" value="<?=$LOGIN_NICK_NAME?>">
<?
        }
?>
      </td>
    </tr>
    <tr align="center" class="TableControl">
      <td nowrap colspan="2">
        <input type="hidden" value="<?=$NEWS_ID?>" name="NEWS_ID">
        <input type="hidden" value="<?=$MANAGE?>" name="MANAGE">
        <input type="submit" value="发表" class="BigButton">&nbsp;&nbsp;
        <input type="button" value="关闭" class="BigButton" onClick="javascript:window.close();">
      </td>
    </tr>
  </table>
</form>
</body>

</html>

⌨️ 快捷键说明

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