Browse Source

Add kick code to getstats.php

Skylar Ittner 2 years ago
parent
commit
3e63bab9d7
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      getstats.php

+ 10
- 1
getstats.php View File

@@ -8,8 +8,17 @@ if (is_empty($VARS['user'])) {
8 8
     sendError("Missing data.", true);
9 9
 }
10 10
 
11
-$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'teamid', 'lastping'], ['nickname' => $VARS['user']])[0];
11
+$stats = $database->select('players', ['level', 'energy', 'maxenergy', 'teamid', 'lastping', 'kick'], ['nickname' => $VARS['user']])[0];
12 12
 
13
+$uuid = $_SESSION['uuid'];
14
+$kick = $database->select('players', ['kick'], ['uuid' => $uuid])[0]['kick'];
15
+if (!is_empty($kick)) {
16
+    $_SESSION['loggedin'] = false;
17
+    session_unset();
18
+    session_destroy();
19
+    $database->update('players', ['kick' => ''], ['uuid' => $uuid]);
20
+    die(json_encode(['status' => 'ERROR', 'kick' => 1, 'message' => $kick]));
21
+}
13 22
 
14 23
 $out = [];
15 24
 $out['status'] = 'OK';

Loading…
Cancel
Save