<?php
include 'config.php';

// Token Verify
if ($_GET['auth_token'] !== AUTH_TOKEN) {
    die(json_encode(["error" => "Unauthorized Access"]));
}

// Get Type
$type = $_GET['type'];
$folder = ($type === 'anugaman') ? ANUGAMAN_DIR : (($type === 'mudda') ? MUDDA_DIR : (($type === 'db') ? DB_DIR : APP_DIR));

$files = array_diff(scandir($folder), array('.', '..'));
echo json_encode($files);
?>
