DEDECMS实现禁止游客发表评论
<p><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>1. 在点击后台系统设置 → 系统基本参数 → 添加新变量 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>变量名为:cfg_feedback_guest 变量值为 1 类型 布尔型 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>2.修改 plus 文件夹下的 feedback.php 文件 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>修改代码如下:将276行---313行替换成: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
//检查游客是否可以发表评论 <br>
if($cfg_feedback_guest=='N') <br>
{ <br>
//检查用户登录 <br>
if(empty($notuser)) <br>
{ <br>
$notuser=0; <br>
} <br>
//匿名发表评论 <br>
if($notuser==1) <br>
{ <br>
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客'; <br>
} <br>
else if($cfg_ml->M_ID > 0) <br>
{ <br>
$username = $cfg_ml->M_UserName; <br>
} <br>
else <br>
{ <br>
if($username!='' && $pwd!='') <br>
{ <br>
$rs = $cfg_ml->CheckUser($username,$pwd); <br>
if($rs==1) <br>
{ <br>
$dsql->ExecuteNoneQuery("Update `dede_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); <br>
} <br>
else <br>
{ <br>
ResetVdValue(); <br>
ShowMsg('管理员设置了游客不允许发表评论,请先登入或注册!','-1'); <br>
exit(); <br>
} <br>
} <br>
else <br>
{ <br>
ResetVdValue(); <br>
ShowMsg('管理员设置了游客不允许发表评论,请先登入或注册!','-1'); <br>
exit(); <br>
} <br>
} <br>
} <br>
else <br>
{ <br>
//检查用户登录 <br>
if(empty($notuser)) <br>
{ <br>
$notuser=0; <br>
} <br>
//匿名发表评论 <br>
if($notuser==1) <br>
{ <br>
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客'; <br>
} <br>
//已登录的用户 <br>
else if($cfg_ml->M_ID > 0) <br>
{ <br>
$username = $cfg_ml->M_UserName; <br>
} <br>
//用户身份验证 <br>
else <br>
{ <br>
if($username!='' && $pwd!='') <br>
{ <br>
$rs = $cfg_ml->CheckUser($username,$pwd); <br>
if($rs==1) <br>
{ <br>
$dsql->ExecuteNoneQuery("Update `dede_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); <br>
} <br>
else <br>
{ <br>
$username = '游客'; <br>
} <br>
} <br>
else <br>
{ <br>
$username = '游客'; <br>
} <br>
} <br>
} </p>
頁:
[1]