chore(cleanup): archive one-time migrations, secure telemetry endpoint, and purge temporary files
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
Downloading Syria map data...
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
␍ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0␍100 239 100 239 0 0 829 0 --:--:-- --:--:-- --:--:-- 829
|
||||
Warning: Failed to open the file
|
||||
Warning: /home/hamzadoctor/app/infrastructure/osm-data/syria-latest.osm.pbf:
|
||||
Warning: No such file or directory
|
||||
␍ 0 73.8M 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
|
||||
curl: (23) Failure writing output to destination, passed 4096 returned 4294967295
|
||||
Generated
+1597
-583
File diff suppressed because it is too large
Load Diff
Generated
+316
-359
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Real-time Driver Location Tracker (Last 10 Days - Full Records)
|
||||
* Real-time Driver Location Tracker (Configurable Days - Full Records)
|
||||
* Used by Intaleq PHP Core to export driver tracks to Map SaaS.
|
||||
*/
|
||||
|
||||
include_once("../../jwtconnect.php");
|
||||
@@ -8,8 +9,8 @@ include_once("../../jwtconnect.php");
|
||||
header('Content-Type: application/json');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
// 2. API Key Validation
|
||||
$expected_api_key = getenv('LOCATION_SERVER_API_KEY') ?: 'intaleq_secret_2026';
|
||||
// 1. API Key Validation (Strict environment check)
|
||||
$expected_api_key = getenv('LOCATION_SERVER_API_KEY');
|
||||
|
||||
function get_api_key()
|
||||
{
|
||||
@@ -25,29 +26,30 @@ function get_api_key()
|
||||
|
||||
$provided_api_key = get_api_key();
|
||||
|
||||
if ($provided_api_key !== $expected_api_key) {
|
||||
if (empty($expected_api_key) || $provided_api_key !== $expected_api_key) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['error' => 'Unauthorized access']);
|
||||
echo json_encode(['error' => 'Unauthorized access: Invalid or missing API key']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 3. API Input (Optional days parameter, default 1)
|
||||
// 2. API Input (Optional days parameter, default 1, max 100)
|
||||
$days = isset($_GET['days']) ? (int)$_GET['days'] : 1;
|
||||
if ($days < 1 || $days > 100) $days = 1;
|
||||
if ($days < 1) $days = 1;
|
||||
if ($days > 100) $days = 100;
|
||||
|
||||
// SQL
|
||||
// 3. SQL Query with Parameterized Bound Values
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM car_tracks
|
||||
WHERE created_at >= NOW() - INTERVAL $days DAY
|
||||
WHERE created_at >= NOW() - INTERVAL :days DAY
|
||||
ORDER BY created_at DESC
|
||||
";
|
||||
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':days', $days, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
// جلب كل النتائج دفعة واحدة
|
||||
$records = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode([
|
||||
@@ -58,11 +60,10 @@ try {
|
||||
'data' => $records
|
||||
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
} catch (PDOException $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'Database error',
|
||||
'details' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user