File size: 675 Bytes
0dff816 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<?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']);
}
?> |