最近访客
百度未收录

DiscuzQ防护批量发帖和批量注册方法

DiscuzQ防护批量发帖和批量注册方法

$cip = Thread::where(\'user_id\', $this->actor->id)->where(\'deleted_at\', NULL)->orderBy(\'created_at\', \'desc\')->first();;
        $cc = Post::where(\'thread_id\', $cip->id)->where(\'is_first\', 1)->first();;
        $now = time();
        $last = strtotime($cip->created_at);
        $d = $now - $last;

        if ($d < 30){
            throw new Exception(\'发帖间隔时间太短\');
        }

        $similar_text =  $this->lcs->getSimilar($cc->content, $this->data[\"attributes\"][\"content\"]);

        if ($similar_text >= 0.8){
            throw new Exception(\'发帖重复\');
        }

1.限制批量发帖

文件:

app\\Commands\\Threa\\CreateThread.php

103行的d$this->events = $events;下方增加

2.限制批量会员注册

文件:

\\app\\Commands\\Users\\RegisterUser.php

$register_ip = Arr::get($this->data, \'register_ip\');
  
        $cip = User::where(\'register_ip\', $register_ip )->whereDate(\'created_at\', date(\"Y-m-d\"))->count();

        if ($cip > 1){
            throw new DecryptException(trans(\'user.register_decrypt_code_failed\'));
        }

在93行下方添加以上代码。

温馨提示:本文最后更新于2022/10/19 22:42:29。若文章内容或图片失效,请留言联系站长反馈!
!
也想出现在这里? 联系我们
创意广告
© 版权声明
THE END
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容