26 lines
630 B
PHP
26 lines
630 B
PHP
<?php
|
|
session_start();
|
|
require_once '../includes/db.php';
|
|
require_once '../includes/api_helper.php';
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
jsonResponse(false, 'Unauthorized', [], 401);
|
|
}
|
|
|
|
$driver_id = $_GET['driver_id'] ?? '';
|
|
|
|
if (empty($driver_id)) {
|
|
jsonResponse(false, 'Driver ID is required');
|
|
}
|
|
|
|
try {
|
|
$stmt = $pdo->prepare("SELECT * FROM driver_documents WHERE driver_id = ? ORDER BY created_at DESC");
|
|
$stmt->execute([$driver_id]);
|
|
$docs = $stmt->fetchAll();
|
|
|
|
jsonResponse(true, 'Success', $docs);
|
|
} catch (PDOException $e) {
|
|
jsonResponse(false, 'Database Error: ' . $e->getMessage());
|
|
}
|
|
?>
|