Beispiel #1
0
require_once 'include/C4Masterserver.php';
require_once 'include/C4Network.php';
require_once 'include/FloodProtection.php';
require_once 'include/ParseINI.php';
$C4HostTestIncludeMode = true;
require_once 'include/C4HostTest.php';
$config = file_get_contents('include/config.ini');
$link = mysql_connect(ParseINI::parseValue('mysql_host', $config), ParseINI::parseValue('mysql_user', $config), ParseINI::parseValue('mysql_password', $config));
//connect to MySQL
$db = mysql_selectdb(ParseINI::parseValue('mysql_db', $config), $link);
//select the database
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();
Beispiel #2
0
        <title>OpenClonk Masterserver</title>
        <meta charset='utf-8'>
        <link rel='stylesheet' href='masterserver.css'>
    </head>
    <body>
		<?php 
readfile($_SERVER['DOCUMENT_ROOT'] . '../www/header/header.html');
?>
        <div id="masterserver">
            <h1>Masterserver</h1>
            <?php 
if ($link && $db) {
    echo GetGamesList();
    echo "<p>";
    echo GetGamesCountText();
    echo "</p>";
    echo '<p>Server address <strong>' . GetServerLink() . '</strong>';
} else {
    echo '<p class="error">Error: Could not connect to database specified in config.</p>';
}
?>
            <div class="footer">
                <p>Powered by C4Masterserver v<?php 
echo C4Masterserver::GetVersion();
?>
 &raquo; by Benedict Etzel</p>
            </div>
        </div>
    </body>
</html>
Beispiel #3
0
<?php

require_once dirname(__FILE__) . '/server/include/C4Masterserver.php';
require_once dirname(__FILE__) . '/server/include/C4Network.php';
require_once dirname(__FILE__) . '/server/include/FloodProtection.php';
require_once dirname(__FILE__) . '/server/include/ParseINI.php';
$config = file_get_contents(dirname(__FILE__) . '/server/include/config.ini');
$link = mysql_connect(ParseINI::parseValue('mysql_host', $config), ParseINI::parseValue('mysql_user', $config), ParseINI::parseValue('mysql_password', $config));
//connect to MySQL
$db = mysql_selectdb(ParseINI::parseValue('mysql_db', $config), $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()) {