diff --git a/modules/billing/data/debug_cart.log b/modules/billing/data/debug_cart.log new file mode 100644 index 00000000..b783902c --- /dev/null +++ b/modules/billing/data/debug_cart.log @@ -0,0 +1,3 @@ +[2025-11-10 03:11:10] SHUTDOWN: no error +[2025-11-10 03:11:21] SHUTDOWN: no error +[2025-11-10 03:14:54] SHUTDOWN: no error diff --git a/modules/billing/includes/admin_auth.php b/modules/billing/includes/admin_auth.php index 8cdc6270..536ae5bf 100644 --- a/modules/billing/includes/admin_auth.php +++ b/modules/billing/includes/admin_auth.php @@ -25,6 +25,14 @@ if (empty($_SESSION['website_user_id'])) { // Require DB config and check role live from panel DB require_once(__DIR__ . '/config.inc.php'); + +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Use a local connection variable so we don't clash with pages that also use $db $auth_db = @mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$auth_db) { diff --git a/modules/billing/includes/menu.php b/modules/billing/includes/menu.php index b5bc61c4..15a7faf7 100644 --- a/modules/billing/includes/menu.php +++ b/modules/billing/includes/menu.php @@ -27,6 +27,14 @@ $is_admin = false; if ($is_logged_in) { // load DB credentials require_once(__DIR__ . '/config.inc.php'); + + // Variables from config.inc.php (helps IDEs understand scope) + /** @var string $db_host Database host */ + /** @var string $db_user Database user */ + /** @var string $db_pass Database password */ + /** @var string $db_name Database name */ + /** @var string $table_prefix Table prefix for database tables */ + // Prefer reusing an existing $db if present, otherwise open a local connection $menu_db = null; $menu_db_opened = false; diff --git a/modules/billing/includes/payment_processor.php b/modules/billing/includes/payment_processor.php index bd126e86..bedd5e39 100644 --- a/modules/billing/includes/payment_processor.php +++ b/modules/billing/includes/payment_processor.php @@ -21,6 +21,13 @@ if (is_file($moduleConfig)) { error_log('[payment_processor] Module config not found: expected ' . $moduleConfig); } +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Normalize table prefix variable: many files use $table_prefix (lowercase) if (!isset($TABLE_PREFIX) && isset($table_prefix)) { $TABLE_PREFIX = $table_prefix; diff --git a/modules/billing/login.php b/modules/billing/login.php index 6ca5a697..c978f8ef 100644 --- a/modules/billing/login.php +++ b/modules/billing/login.php @@ -13,6 +13,13 @@ error_reporting(E_ALL); require_once(__DIR__ . '/includes/config.inc.php'); require_once(__DIR__ . '/includes/log.php'); +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Determine site root up to /_website so we can enforce absolute redirects within this site $script = $_SERVER['SCRIPT_NAME'] ?? ''; $pos = strpos($script, '/_website'); diff --git a/modules/billing/order.php b/modules/billing/order.php index ddcee005..8400aa22 100644 --- a/modules/billing/order.php +++ b/modules/billing/order.php @@ -26,6 +26,13 @@ require_once(__DIR__ . '/includes/login_required.php'); // Include database configuration require_once(__DIR__ . '/includes/config.inc.php'); +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Create database connection $db = mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$db) { diff --git a/modules/billing/payment_success.php b/modules/billing/payment_success.php index b9993ef4..d467e0b2 100644 --- a/modules/billing/payment_success.php +++ b/modules/billing/payment_success.php @@ -7,6 +7,13 @@ session_start(); require_once(__DIR__ . '/includes/config.inc.php'); +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Get PayPal order ID from URL $paypal_order_id = isset($_GET['order_id']) ? trim($_GET['order_id']) : ''; diff --git a/modules/billing/register.php b/modules/billing/register.php index 5492002e..b61b2d43 100644 --- a/modules/billing/register.php +++ b/modules/billing/register.php @@ -3,6 +3,13 @@ session_name("gameservers_website"); session_start(); require_once(__DIR__ . '/includes/config.inc.php'); +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Simple registration form (creates a user in {table_prefix}users with MD5 password) if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['username']) && !empty($_POST['password'])) { $db = mysqli_connect($db_host, $db_user, $db_pass, $db_name); diff --git a/modules/billing/serverlist.php b/modules/billing/serverlist.php index 6bb4f3af..930a121f 100644 --- a/modules/billing/serverlist.php +++ b/modules/billing/serverlist.php @@ -14,6 +14,13 @@ error_reporting(E_ALL); // Include database configuration require_once(__DIR__ . '/includes/config.inc.php'); +// Variables from config.inc.php (helps IDEs understand scope) +/** @var string $db_host Database host */ +/** @var string $db_user Database user */ +/** @var string $db_pass Database password */ +/** @var string $db_name Database name */ +/** @var string $table_prefix Table prefix for database tables */ + // Create database connection $db = mysqli_connect($db_host, $db_user, $db_pass, $db_name); if (!$db) {