<?php
// session.php
session_start();
require_once __DIR__ . "/functions.php";  // DB connection

// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
 header("Location: login.php");
}

$user_id = $_SESSION['user_id'];

$user = getUserById($user_id);
$userbalance = (getUserBalanceSummary($user_id));
/*
// Get user transactions
$transactions = getUserTransactions(1, 1, 10, 'plan_purchase');
print_r($transactions);

// Get user balance summary  
$balance = getUserBalanceSummary(1);
print_r($balance);

// Get all plans
$plans = getAllPlans();
print_r($plans);

// Check if user can purchase plan
$canPurchase = canUserPurchasePlan(1, 2);
print_r($canPurchase);

// Get referral stats
$refStats = getUserReferralStats(1);
print_r($refStats);

// Get user's referrals
$referrals = getUserReferrals(1, 1, 10);
print_r($referrals);
*/
