DEDECMS只允许会员积分大于200的会员投稿或者发布评论
作者:king 日期:2023-04-04 分类:CMS教程
防止恶意投稿或者灌水的又一方法,判断积分是否够一定量,如果够就可以投稿和评论,不够就提示信息。很实用。实现方法:
1.投稿:打开member/article_add.php,找到
02 |
$username = $cfg_ml->M_UserName; |
03 |
$l_jifen=$dsql->GetOne( "Select scores from `js_member` where uname='$username'" ); |
04 |
if ($l_jifen[ 'scores' ]>=200) |
06 |
$dsql->ExecuteNoneQuery( "Update `js_member` set logintime='" . time (). "',loginip='" .GetIP(). "' where mid='{$cfg_ml->M_ID}'; " ); |
11 |
ShowMsg( "对不起,需要200以上积分才能在发布文档!" , "-1" , "0" ,3000); |
|
2.评论:打开plus/feedback_ajax.php,找到
02 |
$username = empty($username) ? '游客' : $username; |
03 |
if (empty($notuser)) $notuser = 0; |
06 |
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客' ; |
08 |
else if ($cfg_ml->M_ID > 0) |
10 |
$username = $cfg_ml->M_UserName; |
12 |
else if ($username!= '' && $ pwd != '' ) |
14 |
$rs = $cfg_ml->CheckUser($username, $ pwd ); |
17 |
$dsql->ExecuteNoneQuery( "Update `js_member` set logintime='" . time (). "',loginip='" .GetIP(). "' where mid='{$cfg_ml->M_ID}'; " ); |
19 |
$cfg_ml = new MemberLogin(); |
|
替换为:
02 |
$username = empty($username) ? '游客' : $username; |
03 |
if (empty($notuser)) $notuser = 0; |
06 |
$username = $cfg_ml->M_ID > 0 ? '匿名' : '游客' ; |
08 |
else if ($cfg_ml->M_ID > 0) |
10 |
$username = $cfg_ml->M_UserName; |
12 |
else if ($username!= '' && $ pwd != '' ) |
14 |
$rs = $cfg_ml->CheckUser($username, $ pwd ); |
17 |
$dsql->ExecuteNoneQuery( "Update `js_member` set logintime='" . time (). "',loginip='" .GetIP(). "' where mid='{$cfg_ml->M_ID}'; " ); |
19 |
$cfg_ml = new MemberLogin(); |
|
这样就可以有效的判断了。其余模型的修改也类似这样的。