diff --git a/app/Middleware/Mod_Mu.php b/app/Middleware/Mod_Mu.php index 8e1be83b..75031cac 100644 --- a/app/Middleware/Mod_Mu.php +++ b/app/Middleware/Mod_Mu.php @@ -22,25 +22,25 @@ class Mod_Mu } $auth = false; - $keyset = explode(',', Config::get('muKey')); - foreach ($keyset as $sinkey) { - if ($key == $sinkey) { + $keys = Config::getMuKey(); + foreach ($keys as $k) { + if ($key == $k) { $auth = true; break; } } - if ($auth == false) { + $node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first(); + if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') { $res['ret'] = 0; - $res['data'] = 'token or source is invalid'; + $res['data'] = 'token or source is invalid, Your ip address is ' . $_SERVER['REMOTE_ADDR']; $response->getBody()->write(json_encode($res)); return $response; } - $node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first(); - if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') { + if ($auth == false) { $res['ret'] = 0; - $res['data'] = 'token or source is invalid, Your ip address is ' . $_SERVER['REMOTE_ADDR']; + $res['data'] = 'token or source is invalid'; $response->getBody()->write(json_encode($res)); return $response; }