8
This commit is contained in:
@@ -6,14 +6,17 @@
|
|||||||
require_once __DIR__ . '/../../connect.php';
|
require_once __DIR__ . '/../../connect.php';
|
||||||
|
|
||||||
// 2. Input Validation & Filtering
|
// 2. Input Validation & Filtering
|
||||||
// We sanitize the inputs to prevent SQL injection or XSS.
|
|
||||||
$rideId = filterRequest("id");
|
$rideId = filterRequest("id");
|
||||||
$driverId = filterRequest("driver_id");
|
$driverId = filterRequest("driver_id");
|
||||||
$status = filterRequest("status"); // Expected: 'Apply' or 'accepted'
|
$status = filterRequest("status"); // Expected: 'Apply' or 'accepted'
|
||||||
$passengerToken = filterRequest("passengerToken");
|
$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
|
// Check if critical data is missing
|
||||||
if (!$rideId || !$driverId) {
|
if (!$rideId || !$driverId) {
|
||||||
|
error_log("⛔ [ACCEPT_RIDE_FAIL] Missing parameters.");
|
||||||
jsonError("Missing required parameters.");
|
jsonError("Missing required parameters.");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -170,11 +173,13 @@ try {
|
|||||||
} else {
|
} else {
|
||||||
// Failure: This means rowCount was 0.
|
// Failure: This means rowCount was 0.
|
||||||
// Reason: The ride status was NOT 'waiting' (another driver took it milliseconds ago).
|
// 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)");
|
jsonError("Ride not available (Already taken)");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Handle unexpected errors
|
// Handle unexpected errors
|
||||||
|
error_log("⛔ [ACCEPT_RIDE_EXCEPTION] " . $e->getMessage());
|
||||||
jsonError("Error: " . $e->getMessage());
|
jsonError("Error: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
2
scratch_log_path.php
Normal file
2
scratch_log_path.php
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
echo ini_get('error_log');
|
||||||
Reference in New Issue
Block a user