Example #1
0
/**
 * Copyright (c) AccountProductions and Sybren Gjaltema, 2014. All rights reserved.
 */
$navPage = "search";
if (!isset($_GET['name'])) {
    echo "<p style='color: #f00; padding: 20px;'>Something isn&apos;t right with that URI! <a href='" . LINKBASE . "' title='Back'>Go Home</a>?</p>";
    die;
}
include_once APPPATH . 'inc/db.php';
include_once APPPATH . 'inc/util.php';
$playerName = $_GET['name'];
$pagenr = 1;
if (isset($_GET['page'])) {
    $pagenr = $_GET['page'];
}
$totalPlayers = findPlayerAmount($mysqli, $mysql_table_prefix, $playerName);
$totalPages = (int) ($totalPlayers / 15) + ($totalPlayers % 15 != 0 ? 1 : 0);
if ($pagenr > $totalPages && $totalPages != 0) {
    $pagenr = $totalPages;
}
?>

<!DOCTYPE html>
<!--
  ~ Copyright (c) AccountProductions and Sybren Gjaltema, 2014. All rights reserved.
-->
<html>
<head>
  <!-- Header -->
  <?php 
include APPPATH . 'inc/header.php';
Example #2
0
<?php

/**
 * 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");