if (!is_numeric($new_userid)) { die('Failed to create user: '******''; // Create the server echo $Servers->create($srv_netid, $this_gid, $new_userid, $tplid, $srv_port, $srv_description, $srv_total_slots, $srv_rcon_pass, $srv_is_private, $srv_private_pass); } else { die('Sorry, no available ip/port combinations available to handle this request!'); } } elseif ($api_action == 'delete' || $api_action == 'terminate' || $api_action == 'terminateserver') { if (empty($api_relid)) { die('No server ID provided'); } echo $Servers->delete($api_relid); } elseif ($api_action == 'restart') { if (empty($api_relid)) { die('No server ID provided'); } echo $Servers->restart($api_relid); } elseif ($api_action == 'stop') { if (empty($api_relid)) { die('No server ID provided'); } echo $Servers->stop($api_relid); } elseif ($api_action == 'suspend' || $api_action == 'unsuspend') { die('Suspend/UnSuspend have not been implemented yet, sorry'); }
load_skin('servers'); // the path to this page $context['path_bar'] = array('servers/' => i18n::s('Servers')); // the title of the page $context['page_title'] = i18n::s('Delete a server'); // not found if (!isset($item['id'])) { include '../error.php'; // deletion is restricted to associates } elseif (!Surfer::is_associate()) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // deletion is confirmed } elseif (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 'yes') { // delete and go back to the index page if (Servers::delete($item['id'])) { Servers::clear($item); Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'servers/'); } // deletion has to be confirmed } elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { Logger::error(i18n::s('The action has not been confirmed.')); } // deletion is restricted to associates if ($item['id'] && Surfer::is_associate()) { // the submit button $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::build_submit_button(i18n::s('Yes, I want to suppress this server'), NULL, NULL, 'confirmed') . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n"; // set the focus Page::insert_script('$("#confirmed").focus();'); // the title of the server $context['text'] .= Skin::build_block($item['title'], 'title');
echo 'success'; } elseif ($url_do == 'create') { $url_descr = $GPXIN['desc']; $url_port = $GPXIN['port']; $url_ownerid = $GPXIN['ownerid']; $url_tplid = $GPXIN['tplid']; $url_gameid = ''; // Don't give a game ID, let the create function determine the game from the template ID // Not implemented yet $total_slots = ''; $rcon_password = ''; $is_private = ''; $private_password = ''; echo $Servers->create($url_netid, $url_gameid, $url_ownerid, $url_tplid, $url_port, $url_descr, $total_slots, $rcon_password, $is_private, $private_password); } elseif ($url_do == 'delete') { echo $Servers->delete($url_id); } elseif ($url_do == 'create_getport') { $url_tplid = $GPXIN['tplid']; $result_port = @mysql_query("SELECT \r\n \t\t\t\t d.port \r\n\t\t\t\t FROM default_games AS d \r\n\t\t\t\t LEFT JOIN templates AS t ON \r\n\t\t\t\t t.cfgid = d.id \r\n\t\t\t\t WHERE \r\n\t\t\t\t t.id = '{$url_tplid}' \r\n\t\t\t\t LIMIT 1") or die('Failed to query for default port'); $row_port = mysql_fetch_row($result_port); $this_port = $row_port[0]; if (empty($this_port)) { echo '(none found)'; } else { echo $this_port; } } elseif ($url_do == 'getinfo') { echo $Servers->getcpuinfo($url_id); } elseif ($url_do == 'getoutput') { echo $Servers->getoutput($url_id); } elseif ($url_do == 'sendscreencmd') {