Panel/modules/ftp/includes/database.inc.php
copilot-swe-agent[bot] f94f830cbb
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>
2026-04-30 13:49:28 +00:00

46 lines
No EOL
2.3 KiB
PHP

<?php
// -------------------------------------------------------------------------------
// | net2ftp: a web based FTP client |
// | Copyright (c) 2003-2013 by David Gartner |
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// -------------------------------------------------------------------------------
// **************************************************************************************
// **************************************************************************************
// ** **
// ** **
function connect2db() {
// --------------
// This function logs user accesses to the site
// --------------
// -------------------------------------------------------------------------
// Global variables
// -------------------------------------------------------------------------
global $net2ftp_settings;
$mydb = mysqli_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"], $net2ftp_settings["dbname"]);
if ($mydb == false || mysqli_connect_errno()) {
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 $mydb;
} // End connect2db
// ** **
// ** **
// **************************************************************************************
// **************************************************************************************
?>