static-variables / jweb /ac1 /src /api /loan-eligibility.php
fellybikush's picture
Upload 99 files
0dff816 verified
raw
history blame
675 Bytes
<?php
session_start();
require_once 'agent-functions.php';
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'Unauthorized']);
exit;
}
if (isset($_GET['id'])) {
$agentId = intval($_GET['id']);
$agent = getAgentDetails($agentId);
if ($agent) {
header('Content-Type: application/json');
echo json_encode($agent);
} else {
header('HTTP/1.1 404 Not Found');
echo json_encode(['error' => 'Agent not found']);
}
} else {
header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Agent ID required']);
}
?>