Discuz!禁止发表重复标题主题的修改方法
打开 include/newthread.inc.php , 查找
代码:
if($subject == '' || $message == '') {
showmessage('post_sm_isnull');
}
在下面添加:
复制内容到剪贴板代码:
// ********************* 重复发帖检测 *****************************
$repeatlevel = 4; // 重复发帖的验证级别
$chk_sql = "SELECT COUNT(*) FROM {$tablepre}posts WHERE ";
$chk_term = "";
switch($repeatlevel) {
case 1:
$chk_term = "subject='{$subject}'";
break;
case 2:
$chk_term = "message='{$message}'";
break;
case 3:
$chk_term = "subject='{$subject}' AND message='{$message}'";
break;
case 4:
$chk_term = "subject='{$subject}' AND message='{$message}' AND authorid='{$discuz_uid}'";
break;
}
if($chk_term) {
$chk_num = $db->result($db->query($chk_sql . $chk_term), 0);
if($chk_num > 0) {
showmessage('请不要重复发帖,这很浪费资源的。请返回。');
}
}
//62网(LieHuo38.Net)教55程
// ********************* 重复发帖检测 *****************************