FSOCKOPEN IS DISABLED - YOU MUST ENABLE THE FEED OPTION

".lgsl_help_info(); return; } else { $output = "


FSOCKOPEN AND CURL ARE DISABLED - LGSL WILL NOT WORK ON THIS HOST

".lgsl_help_info(); return; } } //------------------------------------------------------------------------------------------------------------+ if ($_POST && get_magic_quotes_gpc()) { $_POST = lgsl_stripslashes_deep($_POST); } if (function_exists("mysqli_set_charset")) { @mysqli_set_charset("utf8"); } else { @mysqli_query($lgsl_database, "SET NAMES 'utf8'"); } //------------------------------------------------------------------------------------------------------------+ if (!empty($_POST['lgsl_save_1']) || !empty($_POST['lgsl_save_2'])) { if (!empty($_POST['lgsl_save_1'])) { // LOAD SERVER CACHE INTO MEMORY $db = array(); $mysqli_result = mysqli_query($lgsl_database, "SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}`"); while($mysqli_row = mysqli_fetch_array($mysqli_result, MYSQLI_ASSOC)) { $db["{$mysqli_row['type']}:{$mysqli_row['ip']}:{$mysqli_row['q_port']}"] = array($mysqli_row['status'], $mysqli_row['cache'], $mysqli_row['cache_time']); } } // EMPTY SQL TABLE $mysqli_result = mysqli_query($lgsl_database, "TRUNCATE `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}`") or die(mysqli_error($lgsl_database)); // CONVERT ADVANCED TO NORMAL DATA FORMAT if (!empty($_POST['lgsl_management'])) { $form_lines = explode("\r\n", trim($_POST['form_list'])); foreach ($form_lines as $form_key => $form_line) { list($_POST['form_type'] [$form_key], $_POST['form_ip'] [$form_key], $_POST['form_c_port'] [$form_key], $_POST['form_q_port'] [$form_key], $_POST['form_s_port'] [$form_key], $_POST['form_zone'] [$form_key], $_POST['form_disabled'][$form_key], $_POST['form_comment'] [$form_key]) = explode(":", "{$form_line}:::::::"); } } foreach ($_POST['form_type'] as $form_key => $not_used) { // COMMENTS LEFT IN THEIR NATIVE ENCODING WITH JUST HTML SPECIAL CHARACTERS CONVERTED $_POST['form_comment'][$form_key] = lgsl_htmlspecialchars($_POST['form_comment'][$form_key]); $type = mysqli_real_escape_string($lgsl_database, strtolower(trim($_POST['form_type'] [$form_key]))); $ip = mysqli_real_escape_string($lgsl_database, trim($_POST['form_ip'] [$form_key])); $c_port = mysqli_real_escape_string($lgsl_database, intval(trim($_POST['form_c_port'] [$form_key]))); $q_port = mysqli_real_escape_string($lgsl_database, intval(trim($_POST['form_q_port'] [$form_key]))); $s_port = mysqli_real_escape_string($lgsl_database, intval(trim($_POST['form_s_port'] [$form_key]))); $zone = mysqli_real_escape_string($lgsl_database, trim($_POST['form_zone'] [$form_key])); $disabled = isset($_POST['form_disabled'][$form_key]) ? intval(trim($_POST['form_disabled'][$form_key])) : "0"; $comment = mysqli_real_escape_string($lgsl_database, trim($_POST['form_comment'] [$form_key])); // CACHE INDEXED BY TYPE:IP:Q_PORT SO IF THEY CHANGE THE CACHE IS IGNORED list($status, $cache, $cache_time) = isset($db["{$type}:{$ip}:{$q_port}"]) ? $db["{$type}:{$ip}:{$q_port}"] : array("0", "", ""); $status = mysqli_real_escape_string($lgsl_database, $status); $cache = mysqli_real_escape_string($lgsl_database, $cache); $cache_time = mysqli_real_escape_string($lgsl_database, $cache_time); // THIS PREVENTS PORTS OR WHITESPACE BEING PUT IN THE IP WHILE ALLOWING IPv6 if (preg_match("/(\[[0-9a-z\:]+\])/iU", $ip, $match)) { $ip = $match[1]; } elseif (preg_match("/([0-9a-z\.\-]+)/i", $ip, $match)) { $ip = $match[1]; } list($c_port, $q_port, $s_port) = lgsl_port_conversion($type, $c_port, $q_port, $s_port); // DISCARD SERVERS WITH AN EMPTY IP AND AUTO DISABLE SERVERS WITH SOMETHING WRONG if (!$ip) { continue; } elseif ($c_port < 1 || $c_port > 99999) { $disabled = 1; $c_port = 0; } elseif ($q_port < 1 || $q_port > 99999) { $disabled = 1; $q_port = 0; } elseif (!isset($lgsl_protocol_list[$type])) { $disabled = 1; } $mysqli_query = "INSERT INTO `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` (`type`,`ip`,`c_port`,`q_port`,`s_port`,`zone`,`disabled`,`comment`,`status`,`cache`,`cache_time`) VALUES ('{$type}','{$ip}','{$c_port}','{$q_port}','{$s_port}','{$zone}','{$disabled}','{$comment}','{$status}','{$cache}','{$cache_time}')"; $mysqli_result = mysqli_query($lgsl_database, $mysqli_query) or die(mysqli_error($lgsl_database)); } } //------------------------------------------------------------------------------------------------------------+ if (!empty($_POST['lgsl_map_image_paths'])) { $server_list = lgsl_query_cached_all("s"); foreach ($server_list as $server) { if (!$server['b']['status']) { continue; } $image_map = lgsl_image_map($server['b']['status'], $server['b']['type'], $server['s']['game'], $server['s']['map'], FALSE); $output .= "
{$image_map}
"; } $output .= "




"; return; } //------------------------------------------------------------------------------------------------------------+ if ((!empty($_POST['lgsl_management']) && empty($_POST['lgsl_switch'])) || (empty($_POST['lgsl_management']) && !empty($_POST['lgsl_switch'])) || (!isset($_POST['lgsl_management']) && $lgsl_config['management'])) { $output .= "
TYPE : IP : C PORT : Q PORT : S PORT : ZONES : DISABLED : COMMENT

"; $output .= lgsl_help_info(); return $output; } //------------------------------------------------------------------------------------------------------------+ $output .= "
"; //---------------------------------------------------------+ $mysqli_result = mysqli_query($lgsl_database, "SELECT * FROM `{$lgsl_config['db']['prefix']}{$lgsl_config['db']['table']}` ORDER BY `id` ASC"); while($mysqli_row = mysqli_fetch_array($mysqli_result, MYSQLI_ASSOC)) { $id = $mysqli_row['id']; // ID USED AS [] ONLY RETURNS TICKED CHECKBOXES $output .= " "; $last_type = $mysqli_row['type']; // SET LAST TYPE ( $mysqli_row EXISTS ONLY WITHIN THE LOOP ) } //---------------------------------------------------------+ $id ++; // NEW SERVER ID CONTINUES ON FROM LAST $output .= "
[ ID ] [ Game Type ] [ IP ] [ Connection Port ] [ Query Port ] [ Software Port ] [ Zones ] [ Disabled ] [ Comment ]
{$id}
NEW
"; $output .= lgsl_help_info(); //------------------------------------------------------------------------------------------------------------+ function lgsl_help_info() { return "


[ LGSL ONLINE README ]

- To remove a server, delete the IP, then click Save.

- Leave the query port blank to have LGSL try to fill it in for you.

- Software port is only needed for a few games so it being set 0 is normal.

- Edit the lgsl_config.php to set the background colors and other options.

FSOCKOPEN Enabled: ".(function_exists("fsockopen") ? "YES" : "NO")." ( Required for direct querying of servers )
CURL Enabled: ".((function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec")) ? "YES" : "NO")." ( Used for the feed when fsockopen is disabled )
MBSTRING Enabled: ".(function_exists("mb_convert_encoding") ? "YES" : "NO")." ( Used to show UTF-8 server and player names correctly )
BZIP2 Enabled: ".(function_exists("bzdecompress") ? "YES" : "NO")." ( Used to show Source server settings over a certain size )
ZLIB Enabled: ".(function_exists("gzuncompress") ? "YES" : "NO")." ( Required for America's Army 3 )




"; } //------------------------------------------------------------------------------------------------------------+ function lgsl_stripslashes_deep($value) { $value = is_array($value) ? array_map('lgsl_stripslashes_deep', $value) : stripslashes($value); return $value; } //------------------------------------------------------------------------------------------------------------+ function lgsl_htmlspecialchars($string) { // PHP4 COMPATIBLE WAY OF CONVERTING SPECIAL CHARACTERS WITHOUT DOUBLE ENCODING EXISTING ENTITIES $string = str_replace("\x05\x06", "", $string); $string = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x05\x06$1", $string); $string = htmlspecialchars($string, ENT_QUOTES); $string = str_replace("\x05\x06", "&", $string); return $string; } //------------------------------------------------------------------------------------------------------------+