This commit is contained in:
Hamza-Ayed
2026-04-28 15:25:15 +03:00
parent 06cbf1e19d
commit 86de67a41d
2 changed files with 8 additions and 1 deletions

View File

@@ -6,14 +6,17 @@
require_once __DIR__ . '/../../connect.php';
// 2. Input Validation & Filtering
// We sanitize the inputs to prevent SQL injection or XSS.
$rideId = filterRequest("id");
$driverId = filterRequest("driver_id");
$status = filterRequest("status"); // Expected: 'Apply' or 'accepted'
$passengerToken = filterRequest("passengerToken");
// Log incoming data for debugging
error_log(" [ACCEPT_RIDE_TRY] RideID: '$rideId' | DriverID: '$driverId' | Status: '$status' | PToken: '$passengerToken'");
// Check if critical data is missing
if (!$rideId || !$driverId) {
error_log("⛔ [ACCEPT_RIDE_FAIL] Missing parameters.");
jsonError("Missing required parameters.");
exit;
}
@@ -170,11 +173,13 @@ try {
} else {
// Failure: This means rowCount was 0.
// Reason: The ride status was NOT 'waiting' (another driver took it milliseconds ago).
error_log("⛔ [ACCEPT_RIDE_FAIL] Row count 0 for RideID: '$rideId'. Status wasn't 'waiting'/'wait' or ID is wrong.");
jsonError("Ride not available (Already taken)");
}
} catch (Exception $e) {
// Handle unexpected errors
error_log("⛔ [ACCEPT_RIDE_EXCEPTION] " . $e->getMessage());
jsonError("Error: " . $e->getMessage());
}
?>

2
scratch_log_path.php Normal file
View File

@@ -0,0 +1,2 @@
<?php
echo ini_get('error_log');