Example #1
0
meta-status;<?php 
// this status.php file tells publite2 about the number of available freeciv-web servers in the metaserver.
ini_set("include_path", ini_get("include_path") . ":" . $_SERVER["DOCUMENT_ROOT"]);
include_once "php_code/settings.php";
if ($error_msg != NULL) {
    $config_problem = true;
}
if (!$config_problem) {
    include_once "php_code/php_code_find.php";
    // includes for support routines
    include_once php_code_find("fcdb.php");
    include_once php_code_find("versions_file.php");
    include_once php_code_find("img.php");
    include_once php_code_find("html.php");
    fcdb_metaserver_connect();
}
$stmt = "select count(*) as count from servers UNION ALL select count(*) as count from servers where " . "type = 'singleplayer' and state = 'Pregame' and stamp >= DATE_SUB(NOW(), INTERVAL 1 MINUTE) " . "UNION ALL select count(*) as count from servers where type = 'multiplayer' and state = 'Pregame' and stamp >= DATE_SUB(NOW(), INTERVAL 1 MINUTE)";
$res = fcdb_exec($stmt);
$nr = fcdb_num_rows($res);
if ($nr != 3) {
    print "error";
} else {
    $row = fcdb_fetch_array($res, 0);
    print db2html($row["count"]);
    print ";";
    $row = fcdb_fetch_array($res, 1);
    print db2html($row["count"]);
    print ";";
    $row = fcdb_fetch_array($res, 2);
    print db2html($row["count"]);
}
Example #2
0
function polls_emit_old_polls()
{
    global $webmaster_html;
    fcdb_default_connect();
    echo '<TABLE summary="" WIDTH="100%" BORDER="0" CELLPADDING="0">', "\n";
    echo '<TR>', "\n";
    echo '<TD BGCOLOR="#000000">', "\n";
    echo '<TABLE summary="" BORDER="0" WIDTH="100%">', "\n";
    echo '<TR BGCOLOR="#00688B"><TH> Old Polls </TH></TR>', "\n";
    echo '<TR>', "\n";
    echo '<TD BGCOLOR="#9FB6CD">', "\n";
    echo '<TABLE summary="" WIDTH="100%">', "\n";
    echo '<TR><TD> &nbsp </TD></TR>', "\n";
    echo '<TR>', "\n";
    echo '<TD>', "\n";
    echo '<CENTER>', "\n";
    $stmt = "select * from polls where active='n'";
    $res = fcdb_exec($stmt);
    for ($inx = 0; $inx < fcdb_num_rows($res); $inx++) {
        $poll = fcdb_fetch_array($res, $inx);
        $date = explode(" ", $poll["datetime"]);
        echo "<B><A HREF=\"poll.phtml?num=";
        echo $poll["id"];
        echo "\">";
        echo $poll["title"];
        echo "</A></B><BR>(Last vote: ";
        echo $date[0];
        echo " UTC)<br>\n";
    }
    echo '</CENTER>', "\n";
    echo '<P>', "\n";
    echo '<HR noshade>', "\n";
    echo '<P>If you have an interesting suggestion for a poll, mail ', "{$webmaster_html}.\n";
    echo '</TD>', "\n";
    echo '</TR>', "\n";
    echo '</TABLE>', "\n";
    echo '</TD>', "\n";
    echo '</TR>', "\n";
    echo '</TABLE>', "\n";
    echo '</TD>', "\n";
    echo '</TR>', "\n";
    echo '</TABLE>', "\n";
}