1,
"judul" => "Why " . SITE_NAME . " is the Best Choice for Flight Ticket Booking",
"tanggal" => "Mei 20, 2026",
"gambar" => "https://plain-apac-prod-public.komododecks.com/202606/18/HEhtS0x0XTMKeOdKGn0B/image.jpg",
"link" => "https://" . $namaDomain . "/news-detail-1.php",
"ringkasan" => "Merencanakan perjalanan menjadi lebih mudah dengan akses ke layanan tiket penerbangan tepercaya yang menawarkan efisiensi tinggi serta biaya bersahabat..."
],
[
"id" => 2,
"judul" => "Enjoy Affordable Flight Ticket Promotions with " . SITE_NAME,
"tanggal" => "Mei 20, 2026",
"gambar" => "https://plain-apac-prod-public.komododecks.com/202606/18/SZf9pVXF1HNVAw4GVOrA/image.jpg",
"link" => "https://" . $namaDomain . "/news-detail-2.php",
"ringkasan" => "Menikmati perjalanan udara kini kian terjangkau dengan berbagai skema promo menarik dari " . SITE_NAME . "..."
],
[
"id" => 3,
"judul" => "Trusted Domestic and International Flight Ticket Provider",
"tanggal" => "Mei 20, 2026",
"gambar" => "https://plain-apac-prod-public.komododecks.com/202606/18/JRigeS6pa4s6r3fps7to/image.jpg",
"link" => "https://" . $namaDomain . "/news-detail-3.php",
"ringkasan" => "Menemukan opsi akomodasi transportasi udara terbaik adalah kunci dari lancarnya agenda perjalanan Anda. Percayakan bersama " . SITE_NAME . "..."
]
];
// ==========================================
// KONEKSI DATABASE UTAMA (SINGLE CONNECTION)
// ==========================================
$db_connected = false;
try {
if (!isset($pdo)) {
$host = 'localhost';
$db = 'aervigot_aervigo77';
$user = 'aervigot_aervigo77';
$pass = 'Ewl2547@47';
$charset = 'utf8mb4';
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
];
$pdo = new PDO($dsn, $user, $pass, $options);
}
$db_connected = true;
} catch (PDOException $e) {
$db_connected = false;
}
// ==========================================
// INTEGRASI DATABASE FOOTER SETTINGS (DARI PANEL ADMIN)
// ==========================================
if ($db_connected) {
try {
$stmt_footer = $pdo->prepare("SELECT * FROM footer_settings WHERE id = 1");
$stmt_footer->execute();
$footer_data = $stmt_footer->fetch();
if ($footer_data) {
$urlFooterLogo = $footer_data['logo_url'];
$footerDesc = $footer_data['description'];
$instagramUrl = $footer_data['instagram_url'];
$facebookUrl = $footer_data['facebook_url'];
$emailAdmin = $footer_data['email_address'];
$nomorTelepon = $footer_data['phone_number'];
$nomorWhatsapp = $footer_data['whatsapp_number'];
$alamatLengkap = $footer_data['address'];
$copyrightText = $footer_data['copyright_text'];
$namaDomain = $footer_data['domain_name'];
}
} catch (PDOException $e) {
// Abaikan error dan gunakan fallback default
}
}
// ==========================================
// INTEGRASI DATABASE NAVBAR & HEADER SETTINGS (DARI PANEL ADMIN)
// ==========================================
$menu_items = [];
if ($db_connected) {
try {
// Ambil data konfigurasi umum header (logo & tombol booking)
$stmt_header = $pdo->prepare("SELECT * FROM header_settings WHERE id = 1");
$stmt_header->execute();
$header_data = $stmt_header->fetch();
if ($header_data) {
$urlHeaderLogo = $header_data['logo_url'];
$headerBtnText = $header_data['button_text'];
$headerBtnUrl = $header_data['button_url'];
}
// Ambil daftar menu navigasi terurut
$stmt_menu = $pdo->query("SELECT * FROM header_menu ORDER BY sort_order ASC, id DESC");
$menu_items = $stmt_menu->fetchAll();
} catch (PDOException $e) {
$menu_items = [];
}
}
// Jika database menu kosong atau koneksi gagal, gunakan menu bawaan/fallback
if (empty($menu_items)) {
$menu_items = [
['label' => 'Home', 'url' => 'index.php'],
['label' => 'About Us', 'url' => 'https://' . $namaDomain . '/about-us.php'],
['label' => 'Domestic Flight', 'url' => 'https://' . $namaDomain . '/domestic-flight.php'],
['label' => 'International Flight', 'url' => 'https://' . $namaDomain . '/international-flight.php'],
['label' => 'News', 'url' => 'https://' . $namaDomain . '/news.php']
];
}
// ==========================================
// INTEGRASI DATABASE SUPPORT WIDGET (DARI PANEL ADMIN)
// ==========================================
if ($db_connected) {
try {
$stmt_support = $pdo->prepare("SELECT * FROM support_settings WHERE id = 1");
$stmt_support->execute();
$support_data = $stmt_support->fetch();
if ($support_data) {
$support_is_active = (int)$support_data['is_active'];
$support_title = $support_data['widget_title'];
$support_subtitle = $support_data['widget_subtitle'];
$support_wa_num = $support_data['whatsapp_number'];
$support_wa_msg = $support_data['whatsapp_message'];
$support_color = $support_data['widget_color'];
$support_position = $support_data['widget_position'];
}
} catch (PDOException $e) {
// Abaikan error dan gunakan fallback default
}
}
// ==========================================
// INTEGRASI DATABASE METADATA / FAVICON & TITLE (DARI PANEL ADMIN)
// ==========================================
if ($db_connected) {
try {
$stmt_meta = $pdo->prepare("SELECT * FROM site_meta_settings WHERE id = 1");
$stmt_meta->execute();
$meta_data = $stmt_meta->fetch();
if ($meta_data) {
$site_title = $meta_data['site_title'];
// Hanya menimpa favicon_url jika kolom di database tidak kosong
if (!empty($meta_data['favicon_url'])) {
$favicon_url = $meta_data['favicon_url'];
}
}
} catch (PDOException $e) {
// Abaikan error dan gunakan fallback default
}
}
// ==========================================
// INTEGRASI DATABASE BERITA / NEWS (DARI PANEL ADMIN)
// ==========================================
$loaded_news = [];
if ($db_connected) {
try {
$stmt = $pdo->query("SELECT * FROM news ORDER BY id DESC");
$news_from_db = $stmt->fetchAll();
// Memetakan struktur database ke dalam array visual halaman publik
foreach ($news_from_db as $post) {
$loaded_news[] = [
"id" => $post['id'],
"judul" => $post['title'],
"tanggal" => $post['date_published'],
"gambar" => $post['image_url'],
"link" => $post['link'],
"ringkasan" => $post['summary']
];
}
} catch (PDOException $e) {
$loaded_news = [];
}
}
// Jika database berisi artikel aktif, perbarui $daftarArtikel dengan data terbaru dari admin panel
if (!empty($loaded_news)) {
$daftarArtikel = $loaded_news;
}
// 1. Define Duffel API Key
$apiKey = "duffel_live_XEIBRtwHjUhlHmcYAzLcIyAwryn6xqnyULKw4M9Ru3q";
// ==========================================
// HANDLE AJAX AUTOCOMPLETE SECURE PROXY
// ==========================================
if (isset($_GET['ajax_search'])) {
header('Content-Type: application/json');
$query = urlencode(trim($_GET['query'] ?? ''));
if (strlen($query) < 2) {
echo json_encode(["data" => []]);
exit;
}
$url = "https://api.duffel.com/places/suggestions?query=" . $query;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/json",
"Duffel-Version: v2",
"Authorization: Bearer " . $apiKey
]);
$ajaxResponse = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
echo $ajaxResponse;
} else {
echo json_encode(["data" => []]);
}
exit;
}
// ==========================================
// ----------------------------------------------------------------------
// SAFETY FALLBACK: ENSURE DISCOUNT FUNCTIONS EXIST (Prevents Page Sticking)
// ----------------------------------------------------------------------
if (!function_exists('get_active_flight_discounts')) {
function get_active_flight_discounts($pdo) {
if (!isset($pdo) || $pdo === null) {
return [
'ALL' => [
'type' => 'percentage',
'value' => 5.00
],
'GA' => [
'type' => 'flat',
'value' => 150000.00
]
];
}
try {
$stmt = $pdo->query("SELECT * FROM flight_discounts WHERE is_active = 1");
$discounts = $stmt->fetchAll();
$discount_map = [];
foreach ($discounts as $disc) {
$discount_map[$disc['airline_code']] = [
'type' => $disc['discount_type'],
'value' => floatval($disc['discount_value'])
];
}
return $discount_map;
} catch (\PDOException $e) {
error_log("The flight_discounts table is not ready or has an issue: " . $e->getMessage());
return [];
}
}
}
if (!function_exists('calculate_discounted_price')) {
function calculate_discounted_price($original_price, $airline_code, $discount_map) {
$applied_discount = 0;
if (isset($discount_map[$airline_code])) {
$rule = $discount_map[$airline_code];
}
elseif (isset($discount_map['ALL'])) {
$rule = $discount_map['ALL'];
}
else {
return [
'final_price' => $original_price,
'discount_amount' => 0,
'has_discount' => false
];
}
if ($rule['type'] === 'percentage') {
$applied_discount = $original_price * ($rule['value'] / 100);
} else {
$applied_discount = $rule['value'];
}
$final_price = max(0, $original_price - $applied_discount);
return [
'final_price' => $final_price,
'discount_amount' => $applied_discount,
'has_discount' => $applied_discount > 0
];
}
}
// ----------------------------------------------------------------------
// PERSYARATAN FUNGSI DAN PARAMETER PENCARIAN PENERBANGAN DUFFEL API
// ----------------------------------------------------------------------
function timeToHourIndex($timeStr, $default) {
if (empty($timeStr)) return $default;
$parts = explode(':', $timeStr);
if (count($parts) === 2) {
$hours = (int)$parts[0];
$minutes = (int)$parts[1];
if ($hours === 23 && $minutes === 59) {
return 24;
}
return $hours;
}
return $default;
}
$journeyType = "return";
$origin = "";
$origin_name = "";
$destination = "";
$destination_name = "";
$departureDate = date('Y-m-d', strtotime('+30 days'));
$returnDate = date('Y-m-d', strtotime('+37 days'));
$adults = 1;
$children = 0;
$passengers = 1;
$cabinClass = "economy";
$selected_airline = "";
$depTakeoffFrom = $_GET['dep_takeoff_from'] ?? "00:00";
$depTakeoffTo = $_GET['dep_takeoff_to'] ?? "23:59";
$depLandingFrom = $_GET['dep_landing_from'] ?? "00:00";
$depLandingTo = $_GET['dep_landing_to'] ?? "23:59";
$retTakeoffFrom = $_GET['ret_takeoff_from'] ?? "00:00";
$retTakeoffTo = $_GET['ret_takeoff_to'] ?? "23:59";
$retLandingFrom = $_GET['ret_landing_from'] ?? "00:00";
$retLandingTo = $_GET['ret_landing_to'] ?? "23:59";
$showResults = false;
$offers = [];
$available_airlines = [];
$httpStatusCode = 200;
$responseJson = "";
$errorMessage = "";
if (isset($_GET['search'])) {
$journeyType = $_GET['journey_type'] ?? 'one_way';
$origin = strtoupper(trim($_GET['origin'] ?? ''));
$origin_name = trim($_GET['origin_name'] ?? '');
$destination = strtoupper(trim($_GET['destination'] ?? ''));
$destination_name = trim($_GET['destination_name'] ?? '');
$departureDate = trim($_GET['departure_date'] ?? '');
$returnDate = trim($_GET['return_date'] ?? '');
$selected_airline = trim($_GET['airline_carrier'] ?? '');
$adults = (int)($_GET['adults'] ?? 1);
$children = (int)($_GET['children'] ?? 0);
if (isset($_GET['passengers']) && !isset($_GET['adults'])) {
$passengers = (int)$_GET['passengers'];
$adults = $passengers;
$children = 0;
} else {
if ($adults < 1) $adults = 1;
$passengers = $adults + $children;
}
$cabinClass = $_GET['cabin_class'] ?? 'economy';
if (!empty($origin) && !empty($destination) && !empty($departureDate)) {
$showResults = true;
$depSlice = [
"origin" => $origin,
"destination" => $destination,
"departure_date" => $departureDate
];
if ($depTakeoffFrom !== "00:00" || $depTakeoffTo !== "23:59") {
$depSlice["departure_time"] = ["from" => $depTakeoffFrom, "to" => $depTakeoffTo];
}
if ($depLandingFrom !== "00:00" || $depLandingTo !== "23:59") {
$depSlice["arrival_time"] = ["from" => $depLandingFrom, "to" => $depLandingTo];
}
$slices = [$depSlice];
if ($journeyType === 'return' && !empty($returnDate)) {
$retSlice = [
"origin" => $destination,
"destination" => $origin,
"departure_date" => $returnDate
];
if ($retTakeoffFrom !== "00:00" || $retTakeoffTo !== "23:59") {
$retSlice["departure_time"] = ["from" => $retTakeoffFrom, "to" => $retTakeoffTo];
}
if ($retLandingFrom !== "00:00" || $retLandingTo !== "23:59") {
$retSlice["arrival_time"] = ["from" => $retLandingFrom, "to" => $retLandingTo];
}
$slices[] = $retSlice;
}
$passengersPayload = [];
for ($i = 0; $i < $adults; $i++) {
$passengersPayload[] = ["type" => "adult"];
}
for ($i = 0; $i < $children; $i++) {
$passengersPayload[] = ["type" => "child"];
}
$payload = [
"data" => [
"slices" => $slices,
"passengers" => $passengersPayload,
"cabin_class" => $cabinClass
]
];
$jsonPayload = json_encode($payload);
$url = "https://api.duffel.com/air/offer_requests?return_offers=true";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonPayload);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Accept: application/json",
"Duffel-Version: v2",
"Authorization: Bearer " . $apiKey
]);
$responseJson = curl_exec($ch);
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
$errorMessage = "Connection Error: " . curl_error($ch);
} else {
$response = json_decode($responseJson, true);
$offers = $response['data']['offers'] ?? [];
if (!empty($offers)) {
foreach ($offers as $off) {
$carrier_code = $off['owner']['iata_code'] ?? '';
$carrier_name = $off['owner']['name'] ?? '';
$carrier_logo = $off['owner']['logo_symbol_url'] ?? '';
if (empty($carrier_logo) && !empty($carrier_code)) {
$carrier_logo = "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/" . strtoupper($carrier_code) . ".svg";
}
if (!empty($carrier_code) && !isset($available_airlines[$carrier_code])) {
$available_airlines[$carrier_code] = [
'code' => $carrier_code,
'name' => $carrier_name,
'logo' => $carrier_logo
];
}
}
}
if (!empty($selected_airline) && !empty($offers)) {
$filtered_offers = [];
foreach ($offers as $off) {
$carrier_code = $off['owner']['iata_code'] ?? '';
if (strcasecmp($carrier_code, $selected_airline) === 0) {
$filtered_offers[] = $off;
}
}
$offers = $filtered_offers;
}
// ==========================================
// SORT OFFERS: flights matching user's time preference appear first
// ==========================================
if (!empty($offers)) {
$hasDepTimeFilter = ($depTakeoffFrom !== "00:00" || $depTakeoffTo !== "23:59");
$hasRetTimeFilter = ($retTakeoffFrom !== "00:00" || $retTakeoffTo !== "23:59");
if ($hasDepTimeFilter || $hasRetTimeFilter) {
$depFromSec = strtotime("1970-01-01 {$depTakeoffFrom}:00");
$depToSec = strtotime("1970-01-01 {$depTakeoffTo}:00");
$retFromSec = strtotime("1970-01-01 {$retTakeoffFrom}:00");
$retToSec = strtotime("1970-01-01 {$retTakeoffTo}:00");
foreach ($offers as &$offer) {
$score = 0;
$outSlice = $offer['slices'][0] ?? null;
if ($outSlice && $hasDepTimeFilter && isset($outSlice['segments'][0]['departing_at'])) {
$depTime = strtotime($outSlice['segments'][0]['departing_at']);
$depTimeOnly = $depTime - strtotime(date('Y-m-d', $depTime));
$depMidSec = ($depFromSec + $depToSec) / 2;
$distance = abs($depTimeOnly - $depMidSec);
$maxRange = max(($depToSec - $depFromSec), 1);
if ($depTimeOnly >= $depFromSec && $depTimeOnly <= $depToSec) {
$score += 100;
$score += max(0, 50 - ($distance / $maxRange) * 50);
} else {
$score += max(0, 30 - ($distance / 3600));
}
if ($depLandingFrom !== "00:00" || $depLandingTo !== "23:59") {
$lastSeg = $outSlice['segments'][count($outSlice['segments']) - 1];
if (isset($lastSeg['arriving_at'])) {
$arrTime = strtotime($lastSeg['arriving_at']);
$arrTimeOnly = $arrTime - strtotime(date('Y-m-d', $arrTime));
$landFromSec = strtotime("1970-01-01 {$depLandingFrom}:00");
$landToSec = strtotime("1970-01-01 {$depLandingTo}:00");
if ($arrTimeOnly >= $landFromSec && $arrTimeOnly <= $landToSec) {
$score += 80;
}
}
}
}
if ($journeyType === 'return' && $hasRetTimeFilter && isset($offer['slices'][1])) {
$inSlice = $offer['slices'][1];
if (isset($inSlice['segments'][0]['departing_at'])) {
$retTime = strtotime($inSlice['segments'][0]['departing_at']);
$retTimeOnly = $retTime - strtotime(date('Y-m-d', $retTime));
$retMidSec = ($retFromSec + $retToSec) / 2;
$distance = abs($retTimeOnly - $retMidSec);
$maxRange = max(($retToSec - $retFromSec), 1);
if ($retTimeOnly >= $retFromSec && $retTimeOnly <= $retToSec) {
$score += 100;
$score += max(0, 50 - ($distance / $maxRange) * 50);
} else {
$score += max(0, 30 - ($distance / 3600));
}
if ($retLandingFrom !== "00:00" || $retLandingTo !== "23:59") {
$lastSeg = $inSlice['segments'][count($inSlice['segments']) - 1];
if (isset($lastSeg['arriving_at'])) {
$arrTime = strtotime($lastSeg['arriving_at']);
$arrTimeOnly = $arrTime - strtotime(date('Y-m-d', $arrTime));
$landFromSec = strtotime("1970-01-01 {$retLandingFrom}:00");
$landToSec = strtotime("1970-01-01 {$retLandingTo}:00");
if ($arrTimeOnly >= $landFromSec && $arrTimeOnly <= $landToSec) {
$score += 80;
}
}
}
}
}
$outSegs = count($offer['slices'][0]['segments'] ?? []);
if ($outSegs === 1) $score += 10;
if ($journeyType === 'return' && isset($offer['slices'][1])) {
$retSegs = count($offer['slices'][1]['segments'] ?? []);
if ($retSegs === 1) $score += 10;
}
$offer['_sort_score'] = $score;
}
unset($offer);
usort($offers, function($a, $b) {
return ($b['_sort_score'] ?? 0) - ($a['_sort_score'] ?? 0);
});
}
}
}
curl_close($ch);
}
}
$is_searched = $showResults;
function formatDuration($isoDuration) {
return trim(str_replace(['PT', 'H', 'M'], ['', 'h ', 'm'], $isoDuration));
}
function convertToIdr($amount, $fromCurrency) {
$fromCurrency = strtoupper($fromCurrency);
if ($fromCurrency === 'IDR') return $amount;
$fallbackRates = ['USD' => 16300, 'SGD' => 12100, 'EUR' => 17600, 'IDR' => 1];
if (!isset($_SESSION['exchange_rates'])) {
$ratesJson = @file_get_contents("https://open.er-api.com/v6/latest/USD");
if ($ratesJson) {
$ratesData = json_decode($ratesJson, true);
if (isset($ratesData['rates'])) {
$_SESSION['exchange_rates'] = $ratesData['rates'];
}
}
}
$rates = $_SESSION['exchange_rates'] ?? $fallbackRates;
$idrRate = $rates['IDR'] ?? 16300;
if ($fromCurrency === 'USD') {
return $amount * $idrRate;
}
$fromRate = $rates[$fromCurrency] ?? null;
if ($fromRate) {
return ($amount / $fromRate) * $idrRate;
}
return $amount * ($fallbackRates[$fromCurrency] ?? 1);
}
// ----------------------------------------------------------------------
// HELPER: FILTER URL GENERATION (Keeps all search params intact)
// ----------------------------------------------------------------------
if (!function_exists('getFilterUrl')) {
function getFilterUrl($airlineCode) {
$params = $_GET;
if (empty($airlineCode)) {
unset($params['airline_carrier']);
} else {
$params['airline_carrier'] = $airlineCode;
}
$params['search'] = '1';
return "?" . http_build_query($params);
}
}
?>
= 400): ?>
Search Limitation Occurred:
$errorMessage";
} else {
$response = json_decode($responseJson, true);
if (isset($response['errors'])) {
foreach ($response['errors'] as $error) {
echo "
" . htmlspecialchars($error['title']) . " : " . htmlspecialchars($error['message']) . "
";
}
}
}
?>
Search Results
Flights from to
|
Departure Date:
' . date('d M Y', strtotime($returnDate)) . '' : ''; ?>
| Flight Schedules Found
No flight schedules are currently available matching your selected requirements.
1) {
$inSlice = $offer['slices'][1];
if (isset($inSlice['segments'][0])) {
$rSegs = $inSlice['segments'];
$fRSeg = $rSegs[0];
$lRSeg = $rSegs[count($rSegs) - 1];
$retOrigin = $fRSeg['origin']['iata_code'] ?? '???';
$retDestination = $lRSeg['destination']['iata_code'] ?? '???';
$retDepDate = isset($fRSeg['departing_at']) ? date('d M Y', strtotime($fRSeg['departing_at'])) : '';
$retDepTime = isset($fRSeg['departing_at']) ? date('H:i', strtotime($fRSeg['departing_at'])) : '--:--';
$retArrTime = isset($lRSeg['arriving_at']) ? date('H:i', strtotime($lRSeg['arriving_at'])) : '--:--';
$retDuration = formatDuration($inSlice['duration'] ?? '');
$retCarrierName = $inSlice['owner']['name'] ?? $airlineName;
$retCarrierLogo = $inSlice['owner']['logo_symbol_url'] ?? '';
if (empty($retCarrierLogo) && !empty($inSlice['owner']['iata_code'])) {
$retCarrierLogo = "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/" . strtoupper($inSlice['owner']['iata_code']) . ".svg";
}
}
}
$params = [
'origin' => $fareOrigin,
'destination' => $fareDestination,
'dep_date' => $fareDepDate,
'carrier_name' => $airlineName,
'carrier_logo' => $airlineLogoUrl,
'dep_time' => $fareDepTime,
'arr_time' => $fareArrTime,
'duration' => $fareDuration,
'price' => $finalIdr,
'currency' => 'IDR',
'cabin' => $cabinClass,
'passengers' => $passengers
];
if (count($offer['slices']) > 1) {
$params['ret_origin'] = $retOrigin;
$params['ret_destination'] = $retDestination;
$params['ret_dep_date'] = $retDepDate;
$params['ret_dep_time'] = $retDepTime;
$params['ret_arr_time'] = $retArrTime;
$params['ret_duration'] = $retDuration;
$params['ret_carrier_name'] = $retCarrierName;
$params['ret_carrier_logo'] = $retCarrierLogo;
}
$faresUrl = "fares.php?" . http_build_query($params);
?>
0):
$firstSegment = $segments[0];
$lastSegment = $segments[$segmentCount - 1];
$depTime = isset($firstSegment['departing_at']) ? date('H:i', strtotime($firstSegment['departing_at'])) : '--:--';
$depDate = isset($firstSegment['departing_at']) ? date('d M Y', strtotime($firstSegment['departing_at'])) : '';
$depIata = $firstSegment['origin']['iata_code'] ?? '???';
$arrTime = isset($lastSegment['arriving_at']) ? date('H:i', strtotime($lastSegment['arriving_at'])) : '--:--';
$arrDate = isset($lastSegment['arriving_at']) ? date('d M Y', strtotime($lastSegment['arriving_at'])) : '';
$arrIata = $lastSegment['destination']['iata_code'] ?? '???';
$durationStr = formatDuration($slice['duration'] ?? '');
$transitStatus = ($segmentCount === 1) ? "Direct" : ($segmentCount - 1) . " Transit";
$statusClass = ($segmentCount === 1) ? "status-direct" : "status-transit";
?>
0): ?>
Reschedule & refund available
Real-Time Baggage Policy
Live
Cabin Baggage (Carry-on)
• Quantity: 1 Unit cabin bag per passenger.
• Max Weight: kg / bag.
• Status: Free (Included in Fare)
Checked Baggage
0): ?>
• Quantity: Baggage per passenger.
• Weight per Bag: kg .
• Total Weight / Pax: kg .
• Total Combined Weight ( Pax): kg .
• Checked baggage is not included for free.
You can purchase extra baggage allowance when entering passenger details.
• Estimated Weight: kg per passenger.
• Policy: Subject to standard baggage allowance for .
Meals & Beverage Service
• This flight includes complimentary hot meals served during your journey.
$seg):
if ($segIdx > 0 && $prevArrivingAt):
$layoverTime = strtotime($seg['departing_at']) - strtotime($prevArrivingAt);
$lHours = floor($layoverTime / 3600);
$lMinutes = floor(($layoverTime % 3600) / 60);
$layoverStr = ($lHours > 0 ? $lHours . "h " : "") . $lMinutes . "m";
$layoverAirport = $seg['origin']['name'] ?? $seg['origin']['iata_code'];
?>
Transit at () for