header('Content-Type: text/plain'); //output as plain text if ($link && $db) { $prefix = ParseINI::parseValue('mysql_prefix', $config); $server = new C4Masterserver($link, $config); $server->setTimeoutgames(intval(ParseINI::parseValue('c4ms_timeoutgames', $config))); $server->setDeletegames(intval(ParseINI::parseValue('c4ms_deletegames', $config))); $server->setMaxgames(intval(ParseINI::parseValue('c4ms_maxgames', $config))); $protect = new FloodProtection($link, $prefix); $protect->setMaxflood(intval(ParseINI::parseValue('flood_maxrequests', $config))); if ($protect->checkRequest($_SERVER['REMOTE_ADDR'])) { //flood protection C4Network::sendAnswer(C4Network::createError('Flood protection.')); die; } $server->cleanUp(true); //Cleanup old stuff if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'release-file') { try { registerRelease(); } catch (Exception $e) { C4Network::sendAnswer(C4Network::createError($e->getMessage())); } } else { if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { //data sent from engine? $input = $GLOBALS['HTTP_RAW_POST_DATA']; $action = ParseINI::parseValue('Action', $input); $csid = ParseINI::parseValue('CSID', $input); $csid = mysql_real_escape_string($csid, $link); $reference = mysql_real_escape_string(strstr($input, '[Reference]'), $link);
//select the database $reflist; $server; if ($link && $db) { $server = new C4Masterserver($link, $config); $server->setTimeoutgames(intval(ParseINI::parseValue('c4ms_timeoutgames', $config))); $server->setDeletegames(intval(ParseINI::parseValue('c4ms_deletegames', $config))); $server->setMaxgames(intval(ParseINI::parseValue('c4ms_maxgames', $config))); $protect = new FloodProtection($link, ParseINI::parseValue('mysql_prefix', $config)); $protect->setMaxflood(intval(ParseINI::parseValue('flood_maxrequests', $config))); if ($protect->checkRequest($_SERVER['REMOTE_ADDR'])) { //flood protection $link = NULL; $db = NULL; } else { $server->cleanUp(); } } function GetGamesList() { if (!gotConnection()) { return; } $games = ''; $list = references(); $players = ''; foreach ($list as $reference) { if ($reference['valid']) { $games .= '<tr>'; $games .= '<td>' . htmlspecialchars(ParseINI::parseValue('Title', $reference['data'])) . '</td>'; $games .= '<td>' . htmlspecialchars(ParseINI::parseValue('State', $reference['data'])) . '</td>';