📄 comment.php
字号:
<?php
require "./global.php";
$rootindex['commentlen'] or msg('siteban','index.php');
!$wid && msg('wrongpath','index.php');
require_once R_P."header.php";
$ishtml ? $backlink = "./html_data/".$read['lid']."/".date('ym',$read['date'])."/".$wid.".htm" : $backlink = "read.php?wid=".$wid;
if($job == 'list'){
include_once R_P."code.php";
if(!$read) msg("wrongpath");
$read['html'] = $read['ubb'] = 0;
$read['content'] = xsubstr(readxydw($read['content'],$read['html'],$read['ubb']),300);
if($read['laiyuan']){
$laiyuan = explode("|",$read['laiyuan']);
$laiyuan[1] && $read['laiyuan'] = "<a href='".$laiyuan[1]."' target=_blank>".$laiyuan[0]."</a>";
} else $read['laiyuan'] = "<a href='".$rootindex[siteurl]."' target=_blank>".$rootindex['sitename']."</a>";
$read['visit'] < 1 && $read['visit'] = 1;
$read['date'] = date('Y-m-d H:i',$read['date']);
ReplaceWord($read['content']);
$read['fen']<0 && $read['fen'] = 0;
$page or $page = 1;
$listpage = listpage("xydw_comment","",$rootindex[commentlists]," WHERE wid='$wid'");
$query = $db->query("SELECT author,comment,fen FROM xydw_comment WHERE wid='$wid' AND xianshi='1' ORDER BY dateline DESC LIMIT ".($page-1)*$rootindex[commentlists].",$rootindex[commentlists]");
while($row = $db->fetch_array($query)){
$cnum ++;
$cnum%2 ? $tclass = "bg_one" : $tclass = "bg_two";
ReplaceWord($row[comment]);
$row[author] = xsubstr($row[author],"20");
$row[comment] = readxydw($row[comment],0,$rootindex['commentubb']);
$commenttd .= "\t<tr><td class=$tclass valign=top width='130'><strong>$row[author]</strong><br>评分:$row[fen]</td><td class=$tclass>$row[comment]</td></tr>\n";
}
$commenttd && $commenttd = "<table width='95%' align=left' cellspacing='1px' bgcolor='#EFEFEF'>\n".$commenttd."</table>";
include_once R_P."include/left.php";
include_once temp('comment');
include_once R_P.'footer.php';
} else {
if(!$comment) msg('comment_c',$backlink);
if(!$author) msg('comment_a',$backlink);
if(!$isadmining && $rootindex['commenttime'] && $timestamp-$actiontime<$rootindex['commenttime']) msg('commenttime','index.php','100');
if($comment && $author){
$author = xsubstr($author,20,1);
$rootindex[comment] ? $xianshi = 0 : $xianshi = 1;
$db->query("INSERT INTO xydw_comment SET wid='$wid',author='$author',comment='$comment',fen='$vote_num',xianshi='$xianshi',dateline='$timestamp'");
if($vote_num) {
$row = $db->getone("SELECT fen FROM xydw_art WHERE wid='$wid'");
$rowa = $db->getone("SELECT COUNT(*) AS amount FROM xydw_comment WHERE fen>0 AND wid='$wid'");
$row['amount'] = $rowa['amount'];
$row['fen'] = $row['fen']*$rowa['amount'];
$row['fen'] ? $fen = (int)(($row['fen'] + $vote_num)/($row['amount']+1)) : $fen = $vote_num;
$db->query("UPDATE xydw_art SET comment=comment+1,fen='$fen' WHERE wid='$wid'");
} else {
$db->query("UPDATE xydw_art SET comment=comment+1 WHERE wid='$wid'");
}
if($ishtml){
unset($popmenu);include R_P."include/dohtml.php";
}
msg("comment_ok",$backlink);
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -