diff options
author | hitlerrip <git@hitler.rip> | 2025-08-02 22:59:17 +0200 |
---|---|---|
committer | hitlerrip <git@hitler.rip> | 2025-08-02 22:59:17 +0200 |
commit | d2ec4bfa15e6109d8a282262b5584b8483a00bf9 (patch) | |
tree | c107b972c4d16da09ad1023ade99f5a6d53f056a | |
parent | 67c3af8f8c9bd363f78fcce0c9d08958503918af (diff) | |
download | hitler-clicker-d2ec4bfa15e6109d8a282262b5584b8483a00bf9.tar.gz hitler-clicker-d2ec4bfa15e6109d8a282262b5584b8483a00bf9.tar.bz2 hitler-clicker-d2ec4bfa15e6109d8a282262b5584b8483a00bf9.zip |
minor api changes
- removes "status" key from `index.php` response
- reorders `index.php` response and adds "fromanon" key to it
-rw-r--r-- | backend/index.php | 8 |
1 files 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; |