From 03c75dbf3be4cfb998d1487ebfd4316675c8ccaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Thu, 15 Jul 2021 07:10:34 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AF=E3=82=A4=E3=83=AB=E3=83=89=E3=82=AB?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=A7BOT=E3=82=92BAN=E5=87=BA=E6=9D=A5?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Home/Comment.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/Home/Comment.php b/app/Http/Controllers/Home/Comment.php index 9cb2ec0..a2baa7d 100644 --- a/app/Http/Controllers/Home/Comment.php +++ b/app/Http/Controllers/Home/Comment.php @@ -9,6 +9,16 @@ class Comment { public function add (Request $r) { if (!isset($r->submit)) return ''; if ($r->isvideo == 'f') $id = DB::table('blg_content')->select('id')->where('slug', $r->slug)->first()->id; + $banned = DB::table('blg_blacklist')->get(); + foreach ($banned as $b) { + $ip = explode('.', getIp()); + $ban = explode('.', $b->ipaddress); + if ( + ($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == $ip[2] && $ban[3] == $ip[3]) || + ($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == $ip[2] && $ban[3] == '*') || + ($ban[0] == $ip[0] && $ban[1] == $ip[1] && $ban[2] == '*' && $ban[3] == '*') + ) return redirect('/bot-trap/'); + } $shadow = DB::table('blg_blacklist')->where('ipaddress', getIp())->first(); if ($shadow && !$shadow->isShadow) return array('status' => '0101FF', 'message' => '失礼しますが、あなたはBANされていましたので、コメントを保存できません。');