prepare(" SELECT c.id AS chat_id, c.content, u.username, u.icon, u.overlay, u.id AS user_id, u.birdColor, u.overlayColor, c.deleted_at FROM chats c JOIN users u ON c.userId = u.id WHERE u.banned = 0 ORDER BY c.id DESC LIMIT 50 "); $stmt->execute(); $result = $stmt->get_result(); echo encrypt(json_encode(array_reverse(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['user_id'], 'content' => (int)$row['deleted_at'] == 0 ? $row['content'] : null, 'deleted' => (int)$row['deleted_at'] != 0, 'id' => $row['chat_id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC))))); $conn->close();