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' => 'ユーザ名は既に登録しています。');