<?php
require 'includes/db.php';
require 'includes/functions.php';
session_start();

if (!isset($_SESSION['user_id'])) {
    echo json_encode(['error' => 'Not logged in']);
    exit;
}

$user = getUser($_SESSION['user_id']);

echo json_encode([
    'balance' => $user['balance'],
    'currency' => $user['currency']
]);