コード例 #1
0
    // Admins
    if (isset($_SESSION['gpx_admin'])) {
        if (GPXDEBUG) {
            echo "Saving description: {$url_descr}, for ID: {$url_id}<br>";
        }
        @mysql_query("UPDATE servers SET \r\n                          netid = '{$url_netid}',userid = '{$url_userid}',port = '{$url_port}',maxplayers = '{$url_maxpl}',\r\n                          last_updated = NOW(),startup = '{$url_startup}',working_dir = '{$url_working_dir}',pid_file = '{$url_pid_file}',\r\n                          description = '{$url_descr}',update_cmd = '{$url_updatecmd}',simplecmd = '{$url_cmd}',hostname = '{$url_hostn}',\r\n                          map = '{$url_map}',rcon = '{$url_rcon}',sv_password = '******' \r\n                      WHERE id = '{$url_id}'") or die('Failed to update admin server settings: ' . mysql_error());
    } else {
        @mysql_query("UPDATE servers SET \r\n                          last_updated = NOW(),description = '{$url_descr}',hostname = '{$url_hostn}',\r\n                          map = '{$url_map}',rcon = '{$url_rcon}',sv_password = '******' \r\n                      WHERE id = '{$url_id}' AND userid = '{$gpx_userid}'") or die('Failed to update client server settings!');
    }
    ########################################################################
    // Get net info
    require DOCROOT . '/includes/classes/network.php';
    $Network = new Network();
    $net_info = $Network->netinfo($url_netid);
    // Update server config
    $cfg_upd = $Servers->configupdate($url_id, $srvinfo, $net_info);
    if ($cfg_upd != 'success') {
        die('Failed to update config: ' . $cfg_upd);
    }
    ########################################################################
    // Output
    echo 'success';
} elseif ($url_do == 'startup_save') {
    $sort_order = $GPXIN['sort_list'];
    $startup_type = $GPXIN['start_type'];
    // Get server info
    $srvinfo = $Servers->getinfo($url_id);
    // If simple, update and exit
    if (isset($_SESSION['gpx_admin'])) {
        if ($startup_type == 'smp') {
            @mysql_query("UPDATE servers SET startup = '0' WHERE id = '{$url_id}'") or die('Failed to update startup type');