", $_POST['description']); $service = intval($_POST['service_id']); $stmt = $db->prepare("UPDATE {$table_prefix}billing_services SET description = ? WHERE service_id = ?"); if ($stmt) { $stmt->bind_param("si", $new_description, $service); $stmt->execute(); $stmt->close(); } } /** * Derive OS ('linux'|'windows'|'any') from a game_key string. * Checks for _win / _windows substrings; then _linux; else 'any'. */ function order_game_key_os(string $gameKey): string { $lk = strtolower($gameKey); if (str_contains($lk, '_win')) { return 'windows'; } if (str_contains($lk, '_linux')) { return 'linux'; } return 'any'; } function order_price_is_free($value): bool { return ((int) round(((float)$value) * 100)) === 0; } function order_canonical_game_key(string $gameKey): string { $gameKey = strtolower(trim($gameKey)); if ($gameKey === '') { return ''; } $canonical = preg_replace('/_(linux|linux32|linux64|win|win32|win64|windows|windows32|windows64)$/i', '', $gameKey); return $canonical !== '' ? $canonical : $gameKey; } // --- Fetch the requested service with config_homes join for canonical game info --- $req_service_id = intval($_REQUEST['service_id'] ?? 0); if ($req_service_id !== 0) { $where_service_id = " WHERE bs.enabled = 1 AND bs.service_id=" . $req_service_id; } else { $where_service_id = " WHERE bs.enabled = 1"; } $qry_services = "SELECT bs.*, ch.game_name AS cfg_game_name, ch.game_key AS cfg_game_key FROM {$table_prefix}billing_services bs LEFT JOIN {$table_prefix}config_homes ch ON ch.home_cfg_id = bs.home_cfg_id {$where_service_id} ORDER BY bs.service_name"; $services_result = $db->query($qry_services); if ($services_result === false) { // Fallback: query without join if config_homes doesn't exist in this context $where_service_id_simple = str_replace('bs.', '', $where_service_id); $qry_services = "SELECT *, NULL AS cfg_game_name, NULL AS cfg_game_key FROM {$table_prefix}billing_services {$where_service_id_simple} ORDER BY service_name"; $services_result = $db->query($qry_services); } if ($services_result === false) { echo "

Unable to load service information. Please try again or contact support.

"; error_log("billing order.php: query failed - " . $db->error); billing_maybe_close_db($db); include(__DIR__ . '/includes/footer.php'); echo ''; exit; } $serviceRows = []; while ($row = $services_result->fetch_assoc()) { $serviceRows[] = $row; } $services_result->free(); if ($req_service_id !== 0 && empty($serviceRows)) { error_log("billing order.php: service_id={$req_service_id} not found or not enabled"); echo "

The requested service could not be found or is no longer available.

"; echo "

Back to server list

"; billing_maybe_close_db($db); include(__DIR__ . '/includes/footer.php'); echo ''; exit; } // Check whether remote_servers has a server_os column (added by db_version 6 migration). // We gracefully degrade: if the column is absent, all servers are treated as compatible. $hasServerOsColumn = false; $osColCheck = $db->query("SHOW COLUMNS FROM {$table_prefix}remote_servers LIKE 'server_os'"); if ($osColCheck && $osColCheck->num_rows > 0) { $hasServerOsColumn = true; $osColCheck->free(); } ?>



Order Now
service_id, 'windows' => service_id] if ($svcGameOs !== 'any' && (!empty($canonicalGameName) || !empty($canonicalGameKey))) { $siblingQuery = "SELECT bs.service_id, ch.game_key AS cfg_game_key, ch.game_name AS cfg_game_name FROM {$table_prefix}billing_services bs LEFT JOIN {$table_prefix}config_homes ch ON ch.home_cfg_id = bs.home_cfg_id WHERE bs.enabled = 1"; $siblingResult = $db->query($siblingQuery); if ($siblingResult) { while ($sib = $siblingResult->fetch_assoc()) { $sibGameKey = (string)($sib['cfg_game_key'] ?? ''); $sibCanonical = order_canonical_game_key($sibGameKey); $sibName = (string)($sib['cfg_game_name'] ?? ''); if ($canonicalGameKey !== '') { if ($sibCanonical !== $canonicalGameKey) { continue; } } elseif ($canonicalGameName !== '' && strcasecmp($sibName, $canonicalGameName) !== 0) { continue; } $sibOs = order_game_key_os((string)($sib['cfg_game_key'] ?? '')); $osServiceMap[$sibOs] = (int)$sib['service_id']; } $siblingResult->free(); } } // Always include the current service as a fallback if (!isset($osServiceMap[$svcGameOs]) || $svcGameOs === 'any') { $osServiceMap[$svcGameOs] = (int)$row['service_id']; } $osServiceMapJson = json_encode($osServiceMap, JSON_THROW_ON_ERROR); ?>
" . htmlspecialchars((string)($row['description'] ?? ''), ENT_QUOTES, 'UTF-8') . "

"; echo "
" . "" . "" . "
"; } else { $descEditable = htmlspecialchars(str_replace("
", "\r\n", (string)($row['description'] ?? '')), ENT_QUOTES, 'UTF-8'); echo "
" . "
" . "" . "" . "
"; } } else { echo "

" . htmlspecialchars((string)($row['description'] ?? ''), ENT_QUOTES, 'UTF-8') . "

"; } ?>
Game Server Name
Location 1) { foreach ($osServiceMap as $_os => $sibSvcId) { if ($sibSvcId === (int)$row['service_id']) continue; $sibRow = $db->query("SELECT remote_server_id FROM {$table_prefix}billing_services WHERE service_id = " . intval($sibSvcId) . " LIMIT 1"); if ($sibRow && ($sibData = $sibRow->fetch_assoc())) { foreach (explode(',', (string)($sibData['remote_server_id'] ?? '')) as $part) { $part = trim($part); if ($part !== '' && ctype_digit($part)) { $allAllowedIds[] = (int)$part; } } $sibRow->free(); } } } $allAllowedIds = array_unique($allAllowedIds); if (!empty($allAllowedIds)) { $inList = implode(',', $allAllowedIds); // Select server_os if the column exists (added by db_version 6 migration) $osSel = $hasServerOsColumn ? ', server_os' : ", 'any' AS server_os"; $rsQuery = "SELECT remote_server_id, remote_server_name{$osSel} FROM {$table_prefix}remote_servers WHERE remote_server_id IN ({$inList}) ORDER BY remote_server_name"; $rsResult = $db->query($rsQuery); if ($rsResult) { $firstServer = true; while ($rs = $rsResult->fetch_assoc()) { $rsID = (int)$rs['remote_server_id']; $rsNAME = htmlspecialchars((string)$rs['remote_server_name'], ENT_QUOTES, 'UTF-8'); $rsOs = (string)($rs['server_os'] ?? 'any'); $checked = $firstServer ? ' checked' : ''; // Skip this location if we know the service is OS-specific and the // node OS is incompatible AND no sibling service covers this OS. if ($svcGameOs !== 'any' && $rsOs !== 'any' && $rsOs !== $svcGameOs && !isset($osServiceMap[$rsOs])) { continue; // Incompatible OS variant with no fallback service } $available_server = true; $firstServer = false; $safeOs = htmlspecialchars($rsOs, ENT_QUOTES, 'UTF-8'); echo "
\n" . " \n" . " \n" . "
\n"; } $rsResult->free(); } } ?>
Configure
Player Slots
Months

Player Slots:
Price: $ USD

No available server locations for this game.