= NOW() - INTERVAL 5 SECOND AND (cr.make LIKE '%دراجة%' OR cr.model LIKE '%دراجة%') GROUP BY cl.driver_id ORDER BY ratingDriver DESC, cl.updated_at DESC LIMIT 10; "; $stmt = $con->prepare($sql); $stmt->bindParam(':southwestLat', $southwestLat); $stmt->bindParam(':southwestLon', $southwestLon); $stmt->bindParam(':northeastLat', $northeastLat); $stmt->bindParam(':northeastLon', $northeastLon); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($rows) { $fieldsToDecrypt = [ 'phone', 'email', 'gender', 'birthdate', 'first_name', 'last_name', 'maritalStatus', 'token', 'make', 'car_plate', 'vin' ]; $filteredRows = []; foreach ($rows as &$row) { foreach ($fieldsToDecrypt as $field) { if (isset($row[$field])) { $row[$field] = $encryptionHelper->decryptData($row[$field]); } } // فلترة حسب الجنس if (strtolower($row['gender']) !== 'female') { continue; } // حساب العمر if (!empty($row['birthdate'])) { $birthDate = new DateTime($row['birthdate']); $today = new DateTime(); $row['age'] = $today->diff($birthDate)->y; } else { $row['age'] = null; } $filteredRows[] = $row; } jsonSuccess($filteredRows); } else { jsonError("No car locations found"); } } catch (PDOException $e) { jsonError("Database error: " . $e->getMessage()); }