Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/portal/api/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/portal/api/get-districts.php

<?php
require_once '../config/config.php';

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

if (!isLoggedIn()) {
    echo json_encode([]);
    exit();
}

$areaId = $_GET['area_id'] ?? 0;

if (!$areaId) {
    echo json_encode([]);
    exit();
}

$db = Database::getInstance()->getConnection();
$stmt = $db->prepare("SELECT id, district_name, district_code FROM districts WHERE area_id = :area_id AND is_active = 1 ORDER BY district_name");
$stmt->execute(['area_id' => $areaId]);

echo json_encode($stmt->fetchAll());

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists