fix: harden billing module for standalone portability
- config_loader.php: prefer local billing config FIRST (root cause fix) - was: panel config loaded first, overriding local config with wrong db name - now: local modules/billing/includes/config.inc.php always wins when present - config.inc.php: add $db_port="3306" - config.example.php: new example config with all variables documented - menu.php: add $db_port to mysqli_connect - admin_auth.php: add $db_port; remove hardcoded /_website path detection - bootstrap.php billing_get_db(): add $db_port - login.php: fix /_website path detection - adminserverlist.php: add $db_port; fix hardcoded /modules/billing/ URL - All other mysqli_connect calls: add isset($db_port) port parameter (my_servers, forgot_password, serverlist, server_status, order, register, reset_password, payment_success, my_account, admin_invoices, admin_payments, diag_remote, admin_coupons, test_db_connection, tools/check_db_user, renew_server) - timestamp.txt: updated Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/a3e1e4bb-8eb1-4e6e-b1f8-7f3952301231 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
834d56a506
commit
1247e5e7ca
25 changed files with 105 additions and 70 deletions
|
|
@ -28,7 +28,7 @@ $billing_db_opened_by_bootstrap = false;
|
|||
*/
|
||||
function billing_get_db()
|
||||
{
|
||||
global $billing_db, $db, $db_host, $db_user, $db_pass, $db_name, $billing_db_opened_by_bootstrap;
|
||||
global $billing_db, $db, $db_host, $db_user, $db_pass, $db_name, $db_port, $billing_db_opened_by_bootstrap;
|
||||
if (!empty($billing_db) && ($billing_db instanceof mysqli)) {
|
||||
return $billing_db;
|
||||
}
|
||||
|
|
@ -36,8 +36,9 @@ function billing_get_db()
|
|||
$billing_db = $db;
|
||||
return $billing_db;
|
||||
}
|
||||
$port = isset($db_port) ? (int)$db_port : null;
|
||||
// Try to connect (suppress warnings; caller may check return value)
|
||||
$conn = @mysqli_connect($db_host ?? null, $db_user ?? null, $db_pass ?? null, $db_name ?? null);
|
||||
$conn = @mysqli_connect($db_host ?? null, $db_user ?? null, $db_pass ?? null, $db_name ?? null, $port);
|
||||
if ($conn) {
|
||||
// Set charset when available
|
||||
if (function_exists('mysqli_set_charset')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue