Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to ban visitors from commenting on DEDECMS

Shulou Source: shulou.com Published: 2022-06-02 03:37:17 10月05日 Update

Editor to share with you how DEDECMS banned tourists from commenting. I hope you will learn a lot after reading this article. Let's discuss it together.

How does DEDECMS ban visitors from commenting?

1. Click the background system Settings → system basic parameters → to add a new variable

Variable name: cfg_feedback_guest variable value is 1 type Boolean

two。 Modify feedback.php file under plus folder

The modified code is as follows: replace line 276-313 with:

The code is as follows:

/ / check whether visitors can comment on if ($cfg_feedback_guest=='N') {/ / check that users log in to if (empty ($notuser)) {$notuser=0;} / / comment anonymously if ($notuser==1) {$username = $cfg_ml- > M_ID > 0? 'Anonymous': 'tourist';} else if ($cfg_ml- > M_ID > 0) {$username = $cfg_ml- > cfg_ml- Username;} else {if ($usernameholder account account'& & $pwdfarmer account account') {$rs= $cfg_ml- > CheckUser ($username,$pwd); if ($rs==1) {$dsql- > ExecuteNoneQuery ("Update `UserName" .time (). ", loginip='" .GetIP (). "). Where mid=' {$cfg_ml- > M_ID}'; ");} else {ResetVdValue (); ShowMsg ('the administrator has set up that visitors are not allowed to comment, please login or register first!' ,'- 1'); exit ();}} else {ResetVdValue (); ShowMsg ('the administrator has set up that visitors are not allowed to comment, please login or register first!' ,'- 1'); exit ();} else {/ / check that users log in to if (empty ($notuser)) {$notuser=0;} / / comment anonymously if ($notuser==1) {$username = $cfg_ml- > M_ID > 0? 'Anonymous': 'tourist';} / logged-in user else if ($cfg_ml- > M_ID > 0) {$username = $cfg_ml- > MainUserName;} / / user authentication else {if ($usernameauthentication account) & & $pwduser authentication account') {$rs= $cfg_ml- > CheckUser ($username,$pwd); if ($rs==1) {$dsql- > ExecuteNoneQuery ("Update `UserName" .time (). ", loginip='" .GetIP (). " Where mid=' {$cfg_ml- > M_ID}'; ");} else {$username = 'tourist';}} else {$username = 'tourist';} after reading this article, I believe you have some understanding of how DEDECMS can achieve a ban on tourists' comments. You want to know more about it. Welcome to the industry information channel. Thank you for reading!

Tags: Visitors comments users checks logins codes variables files administrators articles systems management parameters background done Boolean folders more knowledge types Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker Shulou Tech Info Huawei Xiaomi