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されていましたので、コメントを保存できません。');