<?php
include 'config.php';

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

// Latest Labour Details File
$labour_files = array_diff(scandir(LABOURDETAILS, SCANDIR_SORT_DESCENDING), array('.', '..'));
$latest_labour = reset($labour_files);

echo json_encode(["latest_labour_file" => $latest_labour]);
?>