防止恶意投稿或者灌水的又一方法,判断积分是否够一定量,如果够就可以投稿和评论,不够就提示信息。很实用。实现方法:
1.投稿:打开member/article_add.php,找到
if(empty($dopost)) { |
在他后边加入:
//检查用户 $username = $cfg_ml->M_UserName; $l_jifen=$dsql->GetOne("Select scores from `js_member` where uname='$username'"); if($l_jifen['scores']>=200) { $dsql->ExecuteNoneQuery("Update `js_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); } else  {  ResetVdValue();  ShowMsg("对不起,需要200以上积分才能在发布文档!","-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 `js_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; ");         }         $cfg_ml = new MemberLogin();     } |
替换为:
//检查用户 $username = $cfg_ml->M_UserName; $l_jifen=$dsql->GetOne("Select scores from `js_member` where uname='$username'"); if($l_jifen['scores']>=150) { $dsql->ExecuteNoneQuery("Update `js_member` set logintime='".time()."',loginip='".GetIP()."' where mid='{$cfg_ml->M_ID}'; "); } else  {  ResetVdValue();  ShowMsg("对不起,需要150以上积分才能在发布文档!","-1","0",3000); exit();  } |
发表评论
评论列表(条)