From d2ec4bfa15e6109d8a282262b5584b8483a00bf9 Mon Sep 17 00:00:00 2001 From: hitlerrip Date: Sat, 2 Aug 2025 22:59:17 +0200 Subject: minor api changes - removes "status" key from `index.php` response - reorders `index.php` response and adds "fromanon" key to it --- backend/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/index.php b/backend/index.php index 7de8d0a..5c21f34 100644 --- a/backend/index.php +++ b/backend/index.php @@ -33,20 +33,20 @@ $query->execute([ "team" => "allies" ]); $query = $pdo->prepare("INSERT IGNORE INTO `stats` (`team`) VALUES (:team)"); $query->execute([ "team" => "soviet" ]); -$query = $pdo->prepare("SELECT team, clicks FROM stats WHERE team LIKE '%' ORDER BY clicks DESC"); +$query = $pdo->prepare("SELECT team, clicks, fromanon FROM stats WHERE team LIKE '%' ORDER BY clicks DESC"); $query->execute(); $found = $query->fetchALL(PDO::FETCH_ASSOC); -echo '{ "status": "online", '; +echo '{ '; $i = 0; foreach($found as $row): $i++; if ($i === sizeof($found)) { - echo " \"$row[team]\": \"$row[clicks]\" "; + echo " \"$row[team]\": { \"clicks\": \"$row[clicks]\", \"fromanon:\": \"$row[fromanon]\" }"; } else { - echo " \"$row[team]\": \"$row[clicks]\", "; + echo " \"$row[team]\": { \"clicks\": \"$row[clicks]\", \"fromanon:\": \"$row[fromanon]\" }, "; }; endforeach; -- cgit v1.2.3