Example #1
0
function getPlayersAllArray()
{
    require 'variables.php';
    require_once 'variablesdb.php';
    static $playersAllInstance;
    global $resettimeAll;
    $time = time();
    if ($time - $resettimeAll > 120 || $playersAllInstance == null) {
        $resettimeAll = time();
        $playersAllInstance = array();
        $sql = "SELECT name, hash6, player_id FROM " . $playerstable . " ORDER BY name ASC";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_array($result)) {
            $rowName = $row['name'];
            if (strlen($row['hash6']) > 0) {
                $sql = "SELECT name FROM six_profiles WHERE user_id=" . $row['player_id'] . " ORDER BY name ASC";
                $profiles = array();
                $resultProfiles = mysql_query($sql);
                while ($rowProfiles = mysql_fetch_array($resultProfiles)) {
                    $profiles[] = $rowProfiles['name'];
                }
                if (sizeof($profiles) > 0) {
                    $rowName .= " (" . getCommaSeparatedString($profiles) . ")";
                }
            }
            $playersAllInstance[] = $rowName;
        }
    }
    return $playersAllInstance;
}
Example #2
0
$xml_query = "http://127.0.0.1:8192/stats";
$xml = simplexml_load_file($xml_query);
foreach ($xml->lobbies->lobby as $lobby) {
    echo getBoxTop($lobby->attributes()->name, "", false, "");
    $users = array();
    foreach ($lobby->user as $user) {
        $users[] = (string) $user->attributes()->profile;
    }
    natcasesort($users);
    echo "<b>" . sizeof($users) . "</b> ";
    if (sizeof($users) == 0) {
        echo "users";
    } elseif (sizeof($users) == 1) {
        echo "user: "******"users: " . getCommaSeparatedString($users);
    }
    foreach ($lobby->matches as $matches) {
        foreach ($matches->match as $match) {
            echo "<p>";
            echo "Match: <b>" . $match->attributes()->roomName . "</b> - " . $match->attributes()->state . " - Minute " . $match->attributes()->clock;
            echo " - ";
            $homePlayers = "";
            foreach ($match->homeTeam as $homeTeam) {
                if (strlen($homePlayers) > 0) {
                    $homePlayers = $homePlayers . "/" . $homeTeam->profile->attributes()->name;
                } else {
                    $homePlayers = $homeTeam->profile->attributes()->name;
                }
            }
            $awayPlayers = "";