diff --git a/web/app/.default-config.php b/web/app/.default-config.php index 974d264..599b1e3 100644 --- a/web/app/.default-config.php +++ b/web/app/.default-config.php @@ -12,7 +12,8 @@ return [ 'database' => 'app_uoj233', 'username' => 'root', 'password' => '_database_password_', - 'host' => '127.0.0.1' + 'host' => '127.0.0.1', + 'port' => '3306', ], 'web' => [ 'domain' => null, diff --git a/web/app/models/DB.php b/web/app/models/DB.php index a1b9c56..f696a6f 100644 --- a/web/app/models/DB.php +++ b/web/app/models/DB.php @@ -3,7 +3,7 @@ class DB { public static function init() { global $uojMySQL; - @$uojMySQL = mysqli_connect(UOJConfig::$data['database']['host'] . ':3306', UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']); + @$uojMySQL = mysqli_connect(UOJConfig::$data['database']['host'] . ':' . UOJConfig::$data['database']['port'], UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']); if (!$uojMySQL) { echo 'There is something wrong with database >_<.... ' . mysqli_connect_error(); die(); @@ -75,4 +75,4 @@ class DB { global $uojMySQL; return mysqli_affected_rows($uojMySQL); } -} \ No newline at end of file +}