mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-14 19:19:08 +03:00
update db
This commit is contained in:
parent
7f1ea48e44
commit
486c55b7d7
2 changed files with 3 additions and 17 deletions
|
@ -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);
|
||||
|
|
14
index.php
14
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 {
|
||||
|
|
Loading…
Reference in a new issue