From d71e7bbfad2f07f82df0c515608996d250fd4182 Mon Sep 17 00:00:00 2001 From: Bot Date: Mon, 2 Jan 2017 15:43:36 +0100 Subject: Formatting --- includes/pages/guest_stats.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'includes/pages/guest_stats.php') diff --git a/includes/pages/guest_stats.php b/includes/pages/guest_stats.php index 2559dd4d..1994f044 100644 --- a/includes/pages/guest_stats.php +++ b/includes/pages/guest_stats.php @@ -3,32 +3,32 @@ function guest_stats() { global $api_key; - + if (isset($_REQUEST['api_key'])) { if ($_REQUEST['api_key'] == $api_key) { $stats = []; - - list($user_count) = sql_select("SELECT count(*) as `user_count` FROM `User`"); + + list($user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User`"); $stats['user_count'] = $user_count['user_count']; - - list($arrived_user_count) = sql_select("SELECT count(*) as `user_count` FROM `User` WHERE `Gekommen`=1"); + + list($arrived_user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1"); $stats['arrived_user_count'] = $arrived_user_count['user_count']; - + $done_shifts_seconds = sql_select_single_cell("SELECT SUM(`Shifts`.`end` - `Shifts`.`start`) FROM `ShiftEntry` JOIN `Shifts` USING (`SID`) WHERE `Shifts`.`end` < UNIX_TIMESTAMP()"); $stats['done_work_hours'] = round($done_shifts_seconds / (60 * 60), 0); - + $users_in_action = sql_select("SELECT `Shifts`.`start`, `Shifts`.`end` FROM `ShiftEntry` JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID` WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`"); $stats['users_in_action'] = count($users_in_action); - + header("Content-Type: application/json"); raw_output(json_encode($stats)); return; } raw_output(json_encode([ - 'error' => "Wrong api_key." - ])); + 'error' => "Wrong api_key." + ])); } raw_output(json_encode([ - 'error' => "Missing parameter api_key." - ])); + 'error' => "Missing parameter api_key." + ])); } -- cgit v1.2.3-54-g00ecf