<?php
/*
Bryan
Exile Server Manager
*/
session_start();
require 'updateServers.php';
// STUFF
$index = $_POST["index"];
$sort = $_POST["sort"];
$server = $SERVERS[$index];
$schema = $server["database_schema"];
// Get the leaderboard and sort by kills, limit to 1000, might need to change this?
$result = mysqli_query($exile_db, "SELECT a.name, kills, deaths, locker, score, c.name AS clan_name FROM $schema.account a INNER JOIN $schema.clan c ON a.clan_id = c.id ORDER BY kills desc LIMIT 1000");
// Yeah
if (!$result) { die(json_encode(["result" => RESULT_FAILED, "return" => FAILED_QUERY])); }
// Get the array
$s_array = mysqli_fetch_all($result, MYSQLI_ASSOC);
// Pass the array
echo json_encode(["result" => RESULT_SUCCESS, "return" => $s_array]);
?>