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行下方添加以上代码。

原文地址:http://www.5che2.com/

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索