-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats_api.php
67 lines (55 loc) · 1.45 KB
/
stats_api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
* Gladiatus Battle Simulator by Gladiatus Crazy Team
* https://www.facebook.com/GladiatusCrazyAddOn
* Authors : GramThanos, GreatApo
*
* Gladiatus Player Stats API
*/
// Load request player data library
require_once('request_playerData.php');
// Check if all parameters are given
if (
!isset($_REQUEST['country']) ||
!isset($_REQUEST['server']) ||
!(isset($_REQUEST['name']) || isset($_REQUEST['id']))
) {
$output = array(
'error' => true,
'message' => 'At least one parameter is missing.'
);
}
// All parameters were given
else {
// Player info
$player = array(
'country' => $_REQUEST['country'],
'server' => $_REQUEST['server'],
'name' => NULL,
'id' => NULL
);
// Get id or name
if(isset($_REQUEST['id'])){
$player['id'] = $_REQUEST['id'];
}
else if(isset($_REQUEST['name'])){
$player['name'] = $_REQUEST['name'];
}
// Check options
$options = array();
// Profile
$options['profile'] = isset($_REQUEST['profile']);
// Statistics
$options['statistics'] = isset($_REQUEST['statistics']);
// Achievements
$options['achievements'] = isset($_REQUEST['achievements']);
// Turma
$options['turma'] = isset($_REQUEST['turma']);
// If nothing specific was requested, return the profile
if (!$options['profile'] && !$options['statistics'] && !$options['achievements'] && !$options['turma']) {
$options['profile'] = true;
}
// Get results from lib
$output = getPlayerData($player, $options);
}
echo json_encode($output);