<?php
global $access;
if ($access != 1) {
    exit("Direct Access not allowed");
}

require_once('db.php');
$page_name = 'checkout.php';
require_once('inc/libraries-bgo/hotel-get-data.php');
include('currency.php');
//IDs
$hotelid           = mysqli_escape_string($conn, $_GET['hotelid']);
$hotelname         = mysqli_escape_string($conn, $_GET['hotelname']);
$roomcode          = mysqli_escape_string($conn, $_GET['room_code']);
$roomname          = mysqli_escape_string($conn, $_GET['room_name']);
$taxfeeusd         = mysqli_escape_string($conn, $_GET['taxfee']);
$taxfee            = $taxfeeusd*$finaltotal;//new currency
$ratekey           = mysqli_escape_string($conn, $_GET['ratekey']);
$ratecode          = mysqli_escape_string($conn, $_GET['ratecode']);
$ota_priority      = mysqli_escape_string($conn, $_GET['ota_priority']);

require_once('inc/data-bgo/booking-data-in-get.php');

//room 1
$adults[0]                           = $adults0;
$children[0]                         = $children0;
$childrenArray['room-0-child-0-age'] = $children0age0;
$childrenArray['room-0-child-1-age'] = $children0age1;
$childrenArray['room-0-child-2-age'] = $children0age2;
//room 2
$adults[1]                           = $adults1;
$children[1]                         = $children1;
$childrenArray['room-1-child-0-age'] = $children1age0;
$childrenArray['room-1-child-1-age'] = $children1age1;
$childrenArray['room-1-child-2-age'] = $children1age2;
//room 3
$adults[2]                           = $adults2;
$children[2]                         = $children2;
$childrenArray['room-2-child-0-age'] = $children2age0;
$childrenArray['room-2-child-1-age'] = $children2age1;
$childrenArray['room-2-child-2-age'] = $children2age2;
//room 4
$adults[3]                           = $adults3;
$children[3]                         = $children3;
$childrenArray['room-3-child-0-age'] = $children3age0;
$childrenArray['room-3-child-1-age'] = $children3age1;
$childrenArray['room-3-child-2-age'] = $children3age2;
include('inc/page_query.php');

//Hotel Details
$hotel_detail      = mysqli_query($conn, "SELECT hotel_country, hotel_address, hotel_zipcode, hotel_tax FROM hotels WHERE hotel_id = $hotelid");
$hotel_detail_Data = mysqli_fetch_array($hotel_detail);
//Variables
$hotel_country     = $hotel_detail_Data['hotel_country'];
$hotel_address     = $hotel_detail_Data['hotel_address'];
$hotel_zipcode     = $hotel_detail_Data['hotel_zipcode'];
$hotel_tax     	   = $hotel_detail_Data['hotel_tax'];
//calculando precio de habitaciones individuales
require_once('inc/libraries-bgo/room-price.php');
//Payment Gateway
$payment_gateway_pp = mysqli_query($conn, "SELECT * FROM payment_gateway WHERE id = 1");
$paymentpp_Data     = mysqli_fetch_array($payment_gateway_pp);
//Variables
$pp_active          = $paymentpp_Data['active'];

$payment_gateway_ht = mysqli_query($conn, "SELECT * FROM payment_gateway WHERE id = 2");
$paymentht_Data     = mysqli_fetch_array($payment_gateway_ht);
//Variables
$ht_active          = $paymentht_Data['active'];

//if ($pp_active == '1' && $ht_active == '1') {
  //  if ($_SERVER['SERVER_PORT'] !== 443 && (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off')) {
    //    header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
      //  exit;
    //}
//} elseif ($ht_active == '1') {
  //  if ($_SERVER['SERVER_PORT'] !== 443 && (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off')) {
    //    header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
      //  exit;
    //}
//}
?>