<?php
session_start();
include 'config/db.php';

header('Content-Type: application/json');

if(!isset($_SESSION['user_id'])) {
    echo json_encode(['kyc_approved' => false]);
    exit();
}

$user_id = $_SESSION['user_id'];
$query = $conn->query("SELECT kyc_status FROM users WHERE id = $user_id");
$user = $query->fetch_assoc();

echo json_encode(['kyc_approved' => ($user['kyc_status'] == 'approved')]);
?>