Exemplo n.º 1
0
                  onclick="fetchPage(<?php 
echo $pagenr + 1;
?>
)">Newer &rarr;</a></li>
          </ul>
          <div class="table-responsive">
            <table class="table table-hover table-striped table-bordered">
              <thead>
              <tr>
                <th>Player</th>
                <th>Last Online</th>
              </tr>
              </thead>
              <tbody id="search-list">
              <?php 
$players = findPlayer($mysqli, $mysql_table_prefix, $playerName, $pagenr);
if (empty($players)) {
    ?>
                <tr>
                  <th colspan='2'><p class="make-center">No players found having '<?php 
    echo $playerName;
    ?>
' in their
                                                         name</p></th>
                </tr>
              <?php 
} else {
    foreach ($players as $player) {
        echo "<tr>";
        echo "<td><img src='" . $avatar_service_uri . $player['name'] . "/16' class='img-circle avatar-list-icon'> <a href='" . LINKBASE . "players/" . $player['player_id'] . "' title='" . $player['name'] . "&apos;s Stats'>" . $player['name'] . "</a></td>";
        $lastjoin = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], "lastjoin");
Exemplo n.º 2
0
 * Copyright (c) AccountProductions and Sybren Gjaltema, 2014. All rights reserved.
 */
header('Content-Type: application/json');
include __DIR__ . '/../../config.php';
include __DIR__ . '/../db.php';
include __DIR__ . '/../util.php';
if (!isset($_GET['page']) || !isset($_GET['finder'])) {
    die(json_encode("POST not correct, " . var_dump($_GET)));
}
$page = $_GET['page'];
$finder = $_GET['finder'];
$totalPlayers = findPlayerAmount($mysqli, $mysql_table_prefix, $finder);
$totalPages = (int) ($totalPlayers / 15) + ($totalPlayers % 15 != 0 ? 1 : 0);
if ($page > $totalPages && $totalPages != 0) {
    $page = $totalPages;
}
if (!is_numeric($page)) {
    die(json_encode("Page is not a number (???)"));
}
$players = findPlayer($mysqli, $mysql_table_prefix, $finder, $page);
if (!$players || empty($players)) {
    die(json_encode("Query failed, or no players are found"));
}
$arr = array();
array_push($arr, $totalPages);
foreach ($players as $player) {
    $player['lastjoin'] = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], "lastjoin");
    $player['lastleave'] = getPlayerStat($mysqli, $mysql_table_prefix, $player['player_id'], "lastleave");
    array_push($arr, $player);
}
echo json_encode($arr);