<?php
session_start();

if (!isset($_SESSION['sub_admin_id'])) {
    header("Location: login.php");
    exit;
}

// Create $user array globally
$user = [
    'id' => $_SESSION['sub_admin_id'],
    'name' => $_SESSION['sub_admin_name'],
    'mobile' => $_SESSION['sub_admin_mobile'],
    'village_id' => $_SESSION['sub_admin_village_id']
];
?>