-
Notifications
You must be signed in to change notification settings - Fork 0
/
capoAzz_export.php
51 lines (36 loc) · 1.44 KB
/
capoAzz_export.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
<?php
require_once __DIR__ . '/controllers/ErrorHandler.php';
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: access');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Content-Type: application/json; charset=UTF-8');
header('Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With');
require_once __DIR__ . '/database.php';
require_once __DIR__ . '/sendJson.php';
require_once __DIR__ . '/controllers/authHandler.php';
require_once __DIR__ . '/controllers/pointsHandler.php';
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') :
sendJson(200, 'OK');
endif;
//operazioni admin
$authHandler = new AuthHandler();
if ($_SERVER['REQUEST_METHOD'] == 'GET') :
$sql = "SELECT
capo_azz_bet.id AS bet_id,
users.id AS user_id,
users.name AS user_name,
capo_azz_bet.bet_num,
capo_azz_bet.value,
capo_azz_bet.is_valid,
capo_azz_bet.points
FROM
capo_azz_bet
INNER JOIN users ON capo_azz_bet.user_id = users.id
ORDER BY capo_azz_bet.user_id, capo_azz_bet.bet_num;";
$query = mysqli_query($connection, $sql);
$betsDict = $query->fetch_all(MYSQLI_ASSOC);
$value["bets"] = $betsDict;
//lista dati
$response = ["capo_azz_export" => $value];
sendJson(200, '', $response);
endif;