Esempio n. 1
0
             updateBookingActivityDescription($intBookingActivityID);
         }
         $strAlertContent = 'Product <strong>"' . $strBookingProduct . '"</strong> is successfully added to Activity <strong>"' . $strBookingActivity . '"</strong> in Booking <strong>"' . $strBookingCode . '"</strong>!';
         $strLog = 'Product "' . $strBookingProduct . '" is successfully added to Activity "' . $strBookingActivity . '" in Booking "' . $strBookingCode . '"';
     } elseif ($_REQUEST['child_action'] == 'add-activity') {
         if (intval($_REQUEST['frm_booking_id_alt']) > 0) {
             $intBookingID = intval($_REQUEST['frm_booking_id_alt']);
         } else {
             $intBookingID = $db->dbFieldToID('mbs_bookings', 'booking_code', $strBookingCode, 'booking_id');
         }
         $intBookingActivityID = insertBookingActivity($intBookingID);
         $intBookingProductID = insertBookingProduct($intBookingID, $intBookingActivityID);
         $strAlertContent = 'Activity <strong>"' . $strBookingActivity . '"</strong> is successfully added to Booking <strong>"' . $strBookingCode . '"</strong>!';
         $strLog = 'Activity "' . $strBookingActivity . '" is successfully add in Booking "' . $strBookingCode . '"';
     } else {
         $intBookingID = insertBooking();
         if (!$intBookingID || $intBookingID == 0) {
             $intBookingID = $db->dbFieldToID('mbs_bookings', 'booking_code', $strBookingCode, 'booking_id');
         }
         $intBookingActivityID = insertBookingActivity($intBookingID);
         $intBookingProductID = insertBookingProduct($intBookingID, $intBookingActivityID);
         $strAlertContent = 'Booking <strong>"' . $strBookingCode . '"</strong> for <strong>"' . $strSupplierName . '"</strong> is successfully added!';
         $strLog = 'Booking "' . $strBookingCode . '" for "' . $strSupplierName . '" is successfully added';
     }
     updateBookingTotal($intBookingID);
     updateActivityGondola();
     insertLog($strLog);
     showAlert($strAlertContent, $intBookingID, $intBookingActivityID, $intBookingProductID);
 } elseif ($_REQUEST['action'] == 'edit' && $_REQUEST['booking_id']) {
     if ($_REQUEST['child_action'] == 'add-product') {
         if (intval($_REQUEST['frm_product_seq']) == 1) {
require_once "config.php";
require_once "connect_db.php";
require_once "functions.php";
$update_status = "disabled";
CheckCookie();
// Resets app to the index page if timeout is reached. This function is implemented in functions.php
if (isset($_POST["action_"])) {
    $booking_start = dateFormat($_POST["start_date"], "", "Y-m-d") . " " . $_POST["start_hour"] . "00";
    $booking_duration = toSeconds($_POST["duration_days"], $_POST["duration_hours"], $_POST["duration_minutes"]);
    $booking_end = date("Y-m-d H:i:s", strtotime("+" . $booking_duration . " seconds", $booking_start));
    switch ($_POST["action_"]) {
        case "insert_booking":
            insertBooking("insert", $_POST["book_id"], $_POST["booker_id"], $_POST["object_id"], $booking_start, $booking_end, $_POST["misc_info"], $validated);
            break;
        case "update_booking":
            insertBooking("update", $_POST["book_id"], $_POST["booker_id"], $_POST["object_id"], $booking_start, $booking_end, $_POST["misc_info"], $validated);
            break;
    }
} else {
    $sql = "SELECT activity_start, activity_end, activity_step FROM rs_data_objects WHERE object_id = " . $_REQUEST["object_id"] . ";";
    $object = db_query($database_name, $sql, "no", "no");
    $object_ = fetch_array($object);
    $activity_step = $object_["activity_step"];
    if ($_REQUEST["book_id"] == "0") {
        $booking_action = "New booking";
        $start_date = date($date_format, $_GET["stamp"]);
        $start_hour = date("H:i", $_GET["stamp"]);
        $misc_info = "";
        $array_duration = getDuration($activity_step * 60);
        $action_ = "insert_booking";
        $update_status = "";
Esempio n. 3
0
if (!isset($_SESSION["Email"])) {
    printAlert("danger", "You haven't sign in yet!", "../../../index.php");
    exit;
}
$userEmail = $_SESSION["Email"];
$hotelName = $_POST['HotelName'];
$hotelAddr = $_POST['HotelAddr'];
$roomType = $_POST['RoomType'];
$roomPrice = $_POST['RoomPrice'];
$startDate = $_POST['StartDate'];
$endDate = $_POST['EndDate'];
$days = abs(strtotime($startDate) - strtotime($endDate)) / (60 * 60 * 24) + 1;
$bookingID = sha1($startDate . $endDate);
$quantity = $_POST['Quantity'];
$total = (int) $roomPrice * (int) $quantity * (int) $days;
$result = insertBooking($userEmail, $hotelName, $hotelAddr, $roomType, $startDate, $endDate, $quantity, $total);
if ($result) {
    printAlert("success", "Booking Confirmed!!!", "../user_profile/index.php");
} else {
    printAlert("danger", "Booking Failed!!!", "../../../index.php");
}
?>
        <div class="container">
          <table class='table'>
            <tr>
              <td>hotel name</td>
              <td><?php 
echo $hotelName;
?>
</td>
            </tr>