From 1ad6c5f353a7ac398209d657ac73950de5fc5295 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 11:04:09 +0900 Subject: [PATCH] =?UTF-8?q?BOT=E3=81=AF=E7=99=BB=E9=8C=B2=E3=82=84?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E5=87=BA=E6=9D=A5=E3=81=AA?= =?UTF-8?q?=E3=81=84=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/User/Login.php | 11 +++++++++++ app/Http/Controllers/User/Register.php | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/Http/Controllers/User/Login.php b/app/Http/Controllers/User/Login.php index dbbeb3f..b55fec5 100644 --- a/app/Http/Controllers/User/Login.php +++ b/app/Http/Controllers/User/Login.php @@ -20,6 +20,17 @@ class Login { } public function login (Request $r) { + $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/'); + } + if (!empty($r)) { $checkName = DB::table('users')->where('username', $r->username)->first(); diff --git a/app/Http/Controllers/User/Register.php b/app/Http/Controllers/User/Register.php index ac4fbec..d5624df 100644 --- a/app/Http/Controllers/User/Register.php +++ b/app/Http/Controllers/User/Register.php @@ -26,6 +26,17 @@ class Register { public function register (Request $r) { $ip = $_SERVER['REMOTE_ADDR']; + $banned = DB::table('blg_blacklist')->get(); + foreach ($banned as $b) { + $ip = explode('.', $ip); + $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/'); + } + if (!empty($r)) { $existUser = DB::table('users')->select('id')->where('username', $r->username)->count(); if ($existUser != 0) return array('err' => 'ユーザ名は既に登録しています。');