diff --git a/app/Services/DB.php b/app/Services/DB.php index 360b9e1..5d53106 100644 --- a/app/Services/DB.php +++ b/app/Services/DB.php @@ -9,9 +9,9 @@ class DB { public static function connect() { if (self::$pdoInstance === null) { - $dsn = 'mysql:host=127.127.126.50;dbname=ngallery;charset=utf8mb4'; - $username = 'root'; - $password = ''; + $dsn = 'mysql:host='.NGALLERY['root']['db']['host'].';dbname='.NGALLERY['root']['db']['name'].';charset=utf8mb4'; + $username = NGALLERY['root']['db']['login']; + $password = NGALLERY['root']['db']['password']; try { self::$pdoInstance = new PDO($dsn, $username, $password); diff --git a/index.php b/index.php index 1ca56f0..d9f7cb5 100644 --- a/index.php +++ b/index.php @@ -20,20 +20,6 @@ class App } try { if (NGALLERY['root']['maintenance'] === false) { - $userIP = $_SERVER['REMOTE_ADDR']; - - function getCountryCodeByIP($ip) - { - $url = "http://ip-api.com/json/{$ip}?fields=countryCode"; - $response = file_get_contents($url); - $data = json_decode($response, true); - return $data['countryCode'] ?? null; - } - $countryCode = getCountryCodeByIP($userIP); - - if (in_array(strtolower($countryCode), explode(',', NGALLERY['root']['access']['countries']))) { - die(Page::set('Errors/ForbiddenCountry')); - } DB::connect(); Routes::init(); } else {