织梦防止恶意投稿或者灌水的又一方法,判断积分是否够一定量,如果够就可以投稿和评论,不够就提示信息。很实用。实现方法:
1.投稿:打开member/article_add.php,找到
if(empty($dopost))
{
在他后边加入:
//检查用户 $username = $cfg_ml->M_UserName; $l_jifen=$dsql->GetOne("Select scores from `dede_member` where uname='$username'"); if($l_jifen['scores']>=100) { $dsql->ExecuteNoneQuery("Update `dede_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); } else { ResetVdValue(); ShowMsg("对不起,需要100以上积分才能在发布文档!","-1","0",3000); exit(); }2.评论:打开plus/feedback_ajax.php,找到
//检查用户 $username = empty($username) ? '游客' : $username; 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}'; "); } $cfg_ml = new MemberLogin(); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//检查用户
$username = empty($username) ? '游客' : $username;
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}'; ");
}
$cfg_ml = new MemberLogin();
}
替换为:
这样就可以有效的判断了。其余模型的修改也类似这样的。