diff --git a/ride/rides/acceptRide.php b/ride/rides/acceptRide.php index 0167bb8..aee4706 100755 --- a/ride/rides/acceptRide.php +++ b/ride/rides/acceptRide.php @@ -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()); } ?> \ No newline at end of file diff --git a/scratch_log_path.php b/scratch_log_path.php new file mode 100644 index 0000000..28066fc --- /dev/null +++ b/scratch_log_path.php @@ -0,0 +1,2 @@ +