From 0517e27f5abb33a515c32fc11a0d2c65c51179e7 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Fri, 19 Jan 2024 01:28:24 +0700 Subject: [PATCH] Updated --- bt/includes/init_tr.php | 7 +++++++ common.php | 2 -- library/includes/core/mysql.php | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php index 17b7e6a1..fcb6b986 100644 --- a/bt/includes/init_tr.php +++ b/bt/includes/init_tr.php @@ -91,6 +91,13 @@ class sql_db { global $DBS; + // Check MySQL installed + if (!function_exists('mysql_connect') || !extension_loaded('mysql')) + { + $this->log_error(); + error_exit("Error: {$this->engine} extension not installed"); + } + $this->cfg = array_combine($this->cfg_keys, $cfg_values); $this->slow_time = SQL_SLOW_QUERY_TIME; diff --git a/common.php b/common.php index bff579f4..1b20e592 100644 --- a/common.php +++ b/common.php @@ -12,8 +12,6 @@ if (PHP_VERSION_ID < 50304) die('TorrentPier II requires PHP version 5.3.4+. You if (PHP_VERSION_ID >= 70000) die('TorrentPier II requires PHP version lower than PHP 7. Your PHP version ' . PHP_VERSION); // Magic quotes if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) die('Set: magic_quotes_gpc = Off'); -// MySQL -if (!function_exists('mysql_connect') || !extension_loaded('mysql')) die('MySQL extension not installed'); // JSON if (!function_exists('json_encode')) die('json_encode() function not exists'); // getmypid diff --git a/library/includes/core/mysql.php b/library/includes/core/mysql.php index 7d5b7e02..70139ada 100644 --- a/library/includes/core/mysql.php +++ b/library/includes/core/mysql.php @@ -44,6 +44,17 @@ class sql_db { global $DBS; + // Check MySQL installed + if (!function_exists('mysql_connect') || !extension_loaded('mysql')) + { + $init_error = "Error: {$this->engine} extension not installed"; + if (DBG_LOG) + { + dbg_log($init_error, "{$this->engine}-DB-INIT-FAIL_" . TIMENOW); + } + die($init_error); + } + $this->cfg = array_combine($this->cfg_keys, $cfg_values); $this->dbg_enabled = (sql_dbg_enabled() || !empty($_COOKIE['explain'])); $this->do_explain = ($this->dbg_enabled && !empty($_COOKIE['explain']));