Author Topic: New Server Help  (Read 7741 times)

lilb990

  • Autococker
  • Posts: 644
Re: New Server Help
« Reply #20 on: April 04, 2009, 09:00:44 AM »
Currently a Pub and a Speed Pub are up and running. The map rotation will be set today. Match Servers will go up when I can get an IRC match script or learn how to make one. Hopefully by the end of the weekend.

You can also talk to br55HiT about the match script he had one for GT servers but im sure it's easy to change that to your servers.

Br55HiT

  • 68 Carbine
  • Posts: 351
Re: New Server Help
« Reply #21 on: April 04, 2009, 09:33:10 PM »
Working with Henrod on that now. :)

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: New Server Help
« Reply #22 on: April 15, 2009, 09:22:45 AM »
sk89q also set up a server reserving system that works through a web page and allows people to select different server settings.  I've been meaning to set that up on the EV1 servers for some time, but I haven't gotten around to it.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #23 on: April 15, 2009, 06:48:20 PM »
sk89q also set up a server reserving system that works through a web page and allows people to select different server settings.  I've been meaning to set that up on the EV1 servers for some time, but I haven't gotten around to it.
I've already given henry that, but he said he was having problems, so when I get net at my new house I'll help him fix it up :).

Henrod

  • 68 Carbine
  • Posts: 356
Re: New Server Help
« Reply #24 on: April 16, 2009, 07:00:27 PM »
OK. I've been pretty busy the last week so this had to be set aside. I'm currently having trouble with sk89q's server reserve. After configuring it several times I always get this error when I click the lease server button:

Parse error: syntax error, unexpected '{' in /home/vcweb02/public_html/pball/reserve.php on line 106

I have looked at the reserve.php and found all { are closed and I have very little PHP experience. Any help would be greatly appreciated. Basically all I did was rename the config file, as the readme instructed, and put in the appropriate server names, IP's, and ports.

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: New Server Help
« Reply #25 on: April 17, 2009, 11:29:04 AM »
post reserve.php and lets take a look

nub

  • VM-68
  • Posts: 244
Re: New Server Help
« Reply #26 on: April 17, 2009, 02:30:15 PM »
Code: [Select]
<?php // $Id: reserve.php 12 2008-07-30 17:28:32Z the.sk89q $

/**
 * reserve.php - does the work of reserving
 *
 * @version: $Id: reserve.php 12 2008-07-30 17:28:32Z the.sk89q $
 * @license http://www.gnu.org/copyleft/gpl.html
 * @package dpmatchreserve
 * 
 */

require_once "./common.php";
require_once 
"include/DigitalPaintServer.php";

$smarty->assign('title''Lease a Match Server');

$errors = array();

// ===============================
// Get input
// ===============================

$server $_POST['server'];
$password $_POST['password'];
$login_password $_POST['login'];
$bot_check trim($_POST['botcheck']);

$server_info = @$CONFIG['servers'][$server];

if (!isset(
$CONFIG['servers'][$server]) && ($CONFIG['enable_autoselect'] && $server != "autoselect")) {
    
$errors[] = 'A valid server was not selected. Select a valid server to lease.';
}

if (
strval($password) === "") {
    
$errors[] = 'A password must be provided for players to use to login.';
} else if (
preg_match("#[^A-Za-z0-9\\-_!@\\#\\$%\\^&\\*\\(\\)\\+=\\\\/\\{\\}\\[\\]\\.,\\?>
<~`\\|:]#", $password)) {
    $errors[] = 'The password provided contained invalid characters. Stick to standard ASCII characters. No spaces are allowed.';
} else if (strlen($password) > 30) {
    $errors[] = 'The password is too long. Shorten it.';
}

if (strval($login_password) === "") {
    $errors[] = 'A login password must be provided for you to use to change the map and manage players.';
} else if (preg_match("#[^A-Za-z0-9\\-_!@\\#\\$%\\^&\\*\\(\\)\\+=\\\\/\\{\\}\\[\\]\\.,\\?><~`\\|:]#", $login_password)) {
    $errors[] = 'The login password provided contained invalid characters. Stick to standard ASCII characters. No spaces are allowed.';
} else if (strlen($login_password) > 30) {
    $errors[] = 'The login password is too long. Shorten it.';
}

if ($CONFIG['bot_check_string'] && $bot_check != $CONFIG['bot_check_string']) {
    $errors[] = 'Enter the correct value for the spam-bot check';
}

// ===============================
// Process custom settings
// ===============================

$custom_vars = array();

foreach ($CONFIG['user_settings'] as $cvar => $opt) {
    $input = $_POST["var_$cvar"];
    if (strval($input) === "") continue;
   
    if ($opt['type'] == 'int') {
        if (!is_numeric($input)) {
            $errors[] = "The value of <em>$cvar</em> must be an integer";
        } else if ($input < $opt['min']) {
            $errors[] = "The value of <em>$cvar</em> must be equal to or greater than {$opt['min']}";
        } else if ($input > $opt['max']) {
            $errors[] = "The value of <em>$cvar</em> must be equal to or less than {$opt['max']}";
        } else {
            $custom_vars[$cvar] = intval($input);
        }
    } else if ($opt['type'] == 'float') {
        if (!is_numeric($input)) {
            $errors[] = "The value of <em>$cvar</em> must be a float";
        } else if ($input < $opt['min']) {
            $errors[] = "The value of <em>$cvar</em> must be equal to or greater than {$opt['min']}";
        } else if ($input > $opt['max']) {
            $errors[] = "The value of <em>$cvar</em> must be equal to or less than {$opt['max']}";
        } else {
            $custom_vars[$cvar] = floatval($input);
        }
    } else if ($opt['type'] == 'bool') {
        if ($input == "true") {
            $custom_vars[$cvar] = '1';
        } else if ($input == "false") {
            $custom_vars[$cvar] = '0';
        }
    }
    /*else if ($opt['type'] == 'string') {
        if (strlen($input) > 200) {
            $errors[] = "The value of <em>$cvar</em> is too long";
        } else {
            $custom_vars[$cvar] = $input;
        }
    }*/
}

// ===============================
// Is the server available?
// Or auto-select as necessary
// ===============================

if (count($errors) == 0) {
    try {
        if ($CONFIG['enable_autoselect'] && $server == "autoselect") {
            $found_open = false;
           
            foreach ($CONFIG['servers'] as $server => $server_info) {
                $paintball = new DigitalPaintServer($server_info['host'], $server_info['port'], $server_info['rcon_password']);

                if (!$paintball->is_online()) {
                    continue;
                } else if (count($paintball->get_players()) > 0) {
                    continue;
                } else if ($CONFIG['grace_period'] > 0) {
                    $last_lease = @filemtime("cache/last_lease_$server");
                   
                    if ($last_lease > time()-$CONFIG['grace_period']) {
                        continue;
                    }
                }
               
                $found_open = true;
                break;
            }
           
            if (!$found_open) {
                $errors[] = "All servers are currently unavailable; please try again later";
            }
        } else {
            $paintball = new DigitalPaintServer($server_info['host'], $server_info['port'], $server_info['rcon_password']);

            if (!$paintball->is_online()) {
                $errors[] = "<em>".htmlspecialchars($server_info['name'])."</em> is currently offline; please try another server";
            } else if (count($paintball->get_players()) > 0) {
                $errors[] = "<em>".htmlspecialchars($server_info['name'])."</em> is currently in use; please try another server";
            } else if ($CONFIG['grace_period'] > 0) {
                $last_lease = @filemtime("cache/last_lease_$server");
               
                if ($last_lease > time()-$CONFIG['grace_period']) {
                    $errors[] = "<em>".htmlspecialchars($server_info['name'])."</em> was leased by another individual too recently (and it is in the grace period); try another server";
                }
            }
        }
    } catch (DPSBadRCONPasswordException $e) {
        show_fatal_error("Please report this error to the webmaster of this website: the configured RCON password for <em>".htmlspecialchars($server_info['name'])."</em> is incorrect");
    } catch (DPSRCONPasswordUnsetException $e) {
        show_fatal_error("Please report this error to the webmaster of this website: there is no configured RCON password for <em>".htmlspecialchars($server_info['name'])."</em>");
    } catch (DPSConnectionException $e) {
        show_fatal_error("The connection to <em>".htmlspecialchars($server_info['name'])."</em> was lost; please try again");
    }
}

// ===============================
// Any errors?
// ===============================

if (count($errors) > 0) {
    $smarty->assign('errors', $errors);
    $smarty->display('error.tpl');
    exit;
}

// ===============================
// Lease it out
// ===============================

// Grace period
if ($CONFIG['grace_period'] > 0) {
    if (!$fp = @fopen("cache/last_lease_$server", "w")) {
        show_fatal_error("Please report this error to the webmaster of this website: could not write lease grace tracking files to the cache directory (chmod may be necessary)");
    }
    fclose($fp);
}

try {
    // Load the default map
    if (isset($CONFIG['default_map']) && !empty($CONFIG['default_map'])) {
        if ($CONFIG['use_map_command']) {
            $paintball->rcon("map ".$CONFIG['default_map']);
        } else {
            $paintball->rcon_new_map($CONFIG['default_map']);
        }
    }
   
    // What variables do we need to change?
    $login_vars = array('password' => $password,
                        "oppass{$server_info['op_pass_num']}" => $login_password);

    $changed_vars = array_merge($CONFIG['default_settings'], $custom_vars, $login_vars);

    foreach ($changed_vars as $cvar => $value) {
        $paintball->rcon_set_variable($cvar, $value);
    }
   
    // Execute commands
    $commands = explode("\n", $CONFIG['exec_commands_post']);
    foreach ($commands as $command) {
        $command = trim($command);
        if (!$command) {
            continue;
        }   
       
        $paintball->rcon($command);
    }
} catch (DPSBadRCONPasswordException $e) {
    show_fatal_error("Please report this error to the webmaster of this website: the configured RCON password for <em>".htmlspecialchars($server_info['name'])."</em> is incorrect");
} catch (DPSRCONPasswordUnsetException $e) {
    show_fatal_error("Please report this error to the webmaster of this website: there is no configured RCON password for <em>".htmlspecialchars($server_info['name'])."</em>");
} catch (DPSConnectionException $e) {
    show_fatal_error("The connection to <em>".htmlspecialchars($server_info['name'])."</em> was lost; please try again");
}

// ===============================
// Send it off
// ===============================

header(sprintf("Location: {$CONFIG['base_url']}/play.php?server=%d&password=%s&login=%s", $server, urlencode($password), urlencode($login_password)));
exit;


Henrod

  • 68 Carbine
  • Posts: 356
Re: New Server Help
« Reply #27 on: April 22, 2009, 09:59:17 PM »
OK. Got the static IP set on the server FINALLY. Stupid network interface kept clearing out the gateway until I entered the gateway first, then the subnet and static IP. Now that I can access my server remotely, does anyone know how to access the Ubuntu remotely from Vista? I syccessfully logged in from another linux machine so I know that I have the server set up properly. I swear I tried 10 thing I found on google unsuccesfully. Anyone have a proven program to access the desktop form a windows machine?  moving a monitor , keyboard, and mouse over to the rack at work is a pain and I'd like to manage the server from home if possible. Without having a Linux box at home that is. I'd rather stay away from a dual boot if possible as well.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #28 on: April 23, 2009, 12:32:40 AM »
Henrod, i'll tell you on vent l8r.  Mums sorta annoying when I'm supposed to be doing h/w, lol.  I'll teach you how to create a virtual image to the server, thats what I'm gonna do, since I intercoursed up my version of ubuntu :P.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #29 on: April 23, 2009, 02:28:23 AM »
I got mIRC installed on the server box using wine, so the match servers will be bookable when Henrod goes back to the server and puts the script in it.

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: New Server Help
« Reply #30 on: April 23, 2009, 04:22:36 AM »
Henrod, i'll tell you on vent l8r.  Mums sorta annoying when I'm supposed to be doing h/w, lol.  I'll teach you how to create a virtual image to the server, thats what I'm gonna do, since I intercoursed up my version of ubuntu :P.

Cameron,
When you do this, write up a post on it.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #31 on: April 23, 2009, 05:35:39 AM »
About how to create a virtual image?  Sure.  I'll post it in other stuff when I'm finished writing it up :).

KnacK

  • Global Moderator
  • Autococker
  • Posts: 3039
Re: New Server Help
« Reply #32 on: April 23, 2009, 05:49:25 AM »
:D

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #33 on: April 23, 2009, 05:58:07 AM »

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #34 on: April 24, 2009, 01:13:00 AM »
Turns out the mIRC fails to run scripts on linux properly, I can't even run it with wine now, my remote connection just crashes along with the servers, so temporarily they will be offline and once Henrod loads the script onto a Windows machine they'll be good to go :), that indicates to you Henrod, do that :).

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: New Server Help
« Reply #35 on: April 24, 2009, 11:27:05 AM »
Apparently you don't have PHP 5 or something. Line 106 is the try { block, which was added in v5.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #36 on: April 24, 2009, 05:23:13 PM »
Apparently you don't have PHP 5 or something. Line 106 is the try { block, which was added in v5.
Ahh, thats why it worked when I tested it on my webspace then.  Another thing, after I re-installed wine and just tried to configure it, it crashes the remote desktop connection, any particular reason?  It seems to do the same with anything that relys on wine.

Cameron

  • Global Moderator
  • Autococker
  • Posts: 2686
Re: New Server Help
« Reply #37 on: May 02, 2009, 06:36:48 PM »
They're up.... make a post Henrod, geez.

Pub: 76.194.190.16:27910
Speed: 76.194.190.16:27911
Match 1: 76.194.190.16:27912
Match 2: 76.194.190.16:27913
Match 3: 76.194.190.16:27914
Match 4: 76.194.190.16:27915

Right now Warwulf has got his script running on Match 1, so !fang will book that server in #team_s2k.  When Henrod goes back to work, he should be able to get them all going since wine wont run on the server without crashing everything, I think it'll be !match1 !match2, etc atm.