search
HomeCMS TutorialDEDECMSHow does DEDECMS prohibit visitors from posting comments?

How does DEDECMS prohibit visitors from posting comments?

DEDECMS How to ban visitors from posting comments?

1. Click on the background system settings → Basic system parameters → Add a new variable

The variable name is: cfg_feedback_guest The variable value is 1 Type Boolean

Recommended learning :梦Weavercms

2. Modify the feedback.php file under the plus folder

Modify the code as follows: Replace lines 276---313 with:

The code is as follows:

//检查游客是否可以发表评论 
if($cfg_feedback_guest=='N') 
{ 
//检查用户登录 
if(empty($notuser)) 
{ 
$notuser=0; 
} 
//匿名发表评论 
if($notuser==1) 
{ 
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客'; 
} 
else if($cfg_ml->M_ID > 0) 
{ 
$username = $cfg_ml->M_UserName; 
} 
else 
{ 
if($username!='' && $pwd!='') 
{ 
$rs = $cfg_ml->CheckUser($username,$pwd); 
if($rs==1) 
{ 
$dsql->ExecuteNoneQuery("Update `dede_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); 
} 
else 
{ 
ResetVdValue(); 
ShowMsg('管理员设置了游客不允许发表评论,请先登入或注册!','-1'); 
exit(); 
} 
} 
else 
{ 
ResetVdValue(); 
ShowMsg('管理员设置了游客不允许发表评论,请先登入或注册!','-1'); 
exit(); 
} 
} 
} 
else 
{ 
//检查用户登录 
if(empty($notuser)) 
{ 
$notuser=0; 
} 
//匿名发表评论 
if($notuser==1) 
{ 
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客'; 
} 
//已登录的用户 
else if($cfg_ml->M_ID > 0) 
{ 
$username = $cfg_ml->M_UserName; 
} 
//用户身份验证 
else 
{ 
if($username!='' && $pwd!='') 
{ 
$rs = $cfg_ml->CheckUser($username,$pwd); 
if($rs==1) 
{ 
$dsql->ExecuteNoneQuery("Update `dede_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); 
} 
else 
{ 
$username = '游客'; 
} 
} 
else 
{ 
$username = '游客'; 
} 
} 
}

The above is the detailed content of How does DEDECMS prohibit visitors from posting comments?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment