include '../db.php';
include '../util.php';
include '../pages/player-list-getter.php';
include '../queries.php';
if (!isset($_GET['page'])) {
    die(json_encode("POST not correct, " . var_dump($_GET)));
}
$page = $_GET['page'];
$totalPlayers = getAmountOfPlayers($mysqli, $mysql_table_prefix, 0);
$totalPages = (int) ($totalPlayers / 15) + ($totalPlayers % 15 != 0 ? 1 : 0);
if ($page > $totalPages) {
    $page = $totalPages;
}
if (!is_numeric($page)) {
    die(json_encode("Page is not a number (???)"));
}
$players = getPlayerList($mysqli, $mysql_table_prefix, $player_list_sort_by, $player_list_sort_order, $page);
if (!$players || empty($players)) {
    die(json_encode("Query failed, or no players are found"));
}
$arr = array();
array_push($arr, $totalPages);
while ($player = $players->fetch_array()) {
    $newPlayer = array();
    $newPlayer['player_id'] = $player['player_id'];
    $newPlayer['name'] = getPlayerName($mysqli, $mysql_table_prefix, $player['player_id']);
    $newPlayer['lastjoin'] = $player['lastjoin'];
    $newPlayer['lastleave'] = $player['lastleave'];
    array_push($arr, $newPlayer);
}
echo json_encode($arr);
Exemple #2
0
                <!-- Main content -->
                <section class="content">

                <div class="row">
                  <div class="col-lg-6 col-xs-12">
                    <div class="box box-solid bg-aqua">
                        <div class="box-header">
                            <h3 class="box-title">Find a match</h3>
                        </div>
                        <div class="box-body">
                          <div class="form-group">
                              <label>Player</label>
                              <select class="form-control" id="playerSelect">
                                  <option>Player</option>
                                  <?php 
$playerList = getPlayerList($conn);
foreach ($playerList as $player) {
    echo '<option value="' . $player['id'] . '">' . $player['playerName'];
}
?>
                              </select>

                          </div>
                          <div class="form-group">
                              <label>Location</label>
                              <select class="form-control">
                                <option>Court</option>
                                  <?php 
$courtList = getCourtList($conn);
foreach ($courtList as $court) {
    echo '<option value="' . $court['id'] . '">' . $court['locName'];
<?php

/**
 * Copyright (c) AccountProductions and Sybren Gjaltema, 2014. All rights reserved.
 */
header('Content-Type: application/json');
include '../../config.php';
include '../db.php';
include '../util.php';
include '../pages/player-list-getter.php';
include '../queries.php';
$players = getPlayerList($mysqli, $mysql_table_prefix, "online", "desc", 1);
if (!$players || empty($players)) {
    die(json_encode("Query failed, or no players are found"));
}
$arr = array();
while ($player = $players->fetch_array()) {
    $newPlayer = array();
    $newPlayer['player_id'] = $player['player_id'];
    $newPlayer['name'] = getPlayerName($mysqli, $mysql_table_prefix, $player['player_id']);
    $newPlayer['lastjoin'] = $player['lastjoin'];
    $newPlayer['lastleave'] = $player['lastleave'];
    $newPlayer['traveled'] = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], 'move');
    $newPlayer['broke'] = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], 'broken');
    $newPlayer['placed'] = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], 'placed');
    $newPlayer['playtime'] = getPlaytime($mysqli, $mysql_table_prefix, $player['player_id']);
    $arr[] = $newPlayer;
}
echo json_encode($arr);
Exemple #4
0
                                </div><!-- /.box-header -->
                                <div class="box-body no-padding">
                                    <table class="table table-striped">
                                        <tbody>

                                        <tr>
                                            <th style="width: 10px">#</th>
                                            <th>Name</th>
                                            <th>Gender</th>
                                            <th>Wins</th>
                                            <th>Losses</th>
                                            <th>Skill</th>
                                            <th style="width: 40px">Ratio</th>
                                        </tr>
                                        <?php 
$playerRoster = getPlayerList($conn);
foreach ($playerRoster as $player) {
    echo "\n                                          <tr>\n                                              <td>" . $player['id'] . "</td>\n                                              <td>" . $player['playerName'] . "</td>\n                                              <td>" . $player['gender'] . "</td>\n                                              <td>" . $player['wins'] . "</td>\n                                              <td>" . $player['losses'] . "</td>\n                                              <td>\n                                                  <div class=\"progress xs\">\n                                                      <div class=\"progress-bar progress-bar-success\" style=\"width:" . round($player['wins'] / $player['losses'], 3.2) * 15 . "%\"></div>\n                                                  </div>\n                                              </td>\n                                              <td><span class=\"badge bg-red\">" . round($player['wins'] / $player['losses'], 3.2) . "</span></td>\n                                          </tr>\n                                          ";
}
?>


                                    </tbody></table>
                                </div><!-- /.box-body -->
                            </div>

                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->

        <!-- add new calendar event modal -->