Initial commit with updated Auth and media ignored

This commit is contained in:
Hamza-Ayed
2026-04-28 13:04:27 +03:00
commit 67af97474c
477 changed files with 66444 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
require_once __DIR__ . '/../../connect.php';
$driver_id = filterRequest("driver_id");
// Get the current date.
$current_date = date('Y-m-d');
// Create a SQL query to select the total duration for the driver today.
$sql = "SELECT
SEC_TO_TIME(COUNT(*) * 60) AS total_duration
FROM
car_tracks
WHERE
car_tracks.driver_id = '$driver_id'
AND car_tracks.created_at >= '$current_date'
AND car_tracks.created_at < DATE_ADD('$current_date', INTERVAL 1 DAY);";
$stmt = $con->prepare($sql);
$stmt->execute();
$car_locations = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($car_locations) {
// Print the car location data as JSON
jsonSuccess($car_locations);
} else {
// Print a failure message
jsonError($message = "No car locations found");
}
?>