Address code review feedback: improve error handling and clean up no-op function signature
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/209fe796-9a38-47c1-a6b7-992ce11d038b Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
c0bd0a0bb5
commit
f94f830cbb
3 changed files with 4 additions and 4 deletions
|
|
@ -29,8 +29,8 @@ function connect2db() {
|
||||||
global $net2ftp_settings;
|
global $net2ftp_settings;
|
||||||
|
|
||||||
$mydb = mysqli_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"], $net2ftp_settings["dbname"]);
|
$mydb = mysqli_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"], $net2ftp_settings["dbname"]);
|
||||||
if ($mydb == false) {
|
if ($mydb == false || mysqli_connect_errno()) {
|
||||||
setErrorVars(false, __("Unable to connect to the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
|
setErrorVars(false, __("Unable to connect to the MySQL database or select the database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ $net2ftp_globals["browser_platform"] = getBrowser("platform");
|
||||||
// ** **
|
// ** **
|
||||||
// ** **
|
// ** **
|
||||||
|
|
||||||
function remove_magic_quotes(&$x, $keyname="") {
|
function remove_magic_quotes($x, $keyname="") {
|
||||||
|
|
||||||
// get_magic_quotes_gpc() was removed in PHP 8.0; magic quotes are always
|
// get_magic_quotes_gpc() was removed in PHP 8.0; magic quotes are always
|
||||||
// disabled on PHP 5.4+, so this function is now a no-op kept for
|
// disabled on PHP 5.4+, so this function is now a no-op kept for
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class MySQLModuleDatabase extends OGPDatabaseMySQL
|
||||||
|
|
||||||
$this->link = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
|
$this->link = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
|
||||||
|
|
||||||
if ( $this->link === FALSE )
|
if ( $this->link === FALSE || mysqli_connect_errno() )
|
||||||
return -11;
|
return -11;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue