示例#1
0
     $values[] = $_POST['flight'];
     $values[] = $_POST['parking_points'];
     $values[] = $_POST['discount_type'];
     $types = 'ssssssssssssssiissi';
     if ($db->insert('bookings', $keys, $values, $types)) {
         $error = "Booking added successfully!";
     } else {
         $error = "Booking added unsuccessfully - Query failed!";
     }
     $_POST['payment_type'] = 'Frontdesk payment';
     $data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'email' => $_POST['email_address'], 'telephone' => $_POST['telephone'], 'departDate' => $_POST['departDate'], 'departTime' => $_POST['departTime'], 'arriveDate' => $_POST['arrivaDate'], 'arriveTime' => $_POST['arriveTime'], 'model' => $_POST['vehicleModel'], 'color' => $_POST['vehicleColor'], 'registration' => $_POST['vehicleRegistration'], 'discountType' => $_POST['discountType'], 'discount' => $_POST['discountPercent'], 'payment_type' => $_POST['payment_type'], 'meetup_time' => $_POST['meet'], 'points' => $_POST['parking_points'], 'flight' => $_POST['code'], 'cost' => $_POST['cost']);
     if ($_POST['discountType'] == 'Voucher') {
         $db->delete('vouchers', 'code = "' . $_POST['code'] . '"');
     }
     //$emailer->bookingInternalEmail($data);
     echo json_encode($emailer->frontdeskEmail($data));
     break;
 case 'payment_success':
     //update booking as as paid and get data for email
     $keys = array();
     $keys[] = "statii_id";
     $values = array();
     $values[] = '3';
     $row = $db->getRowsByQuery('SELECT * FROM bookings WHERE bookings_id = ' . $_POST['booking_id']);
     //if it is an online payment
     if ($row["payment_methods_id"] == 3) {
         $data = array('firstname' => $row['first_name'], 'lastname' => $row['last_name'], 'email' => $row['email'], 'telephone' => $row['phone'], 'departDate' => $row['depart'], 'arriveDate' => $row['arrive'], 'model' => $row['make'], 'color' => $row['colour'], 'discountType' => $_POST['discount_type'], 'discount' => $_POST['discount_percent'], 'registration' => $row['reg'], 'payment_type' => 'Online Credit Card', 'meetup_time' => $row['meet'], 'points' => $_POST['parking_points'], 'flight' => $_POST['flight'], 'discount' => $_POST['discount_type'], 'cost' => $row['amount']);
         $db->update('bookings_id', $_POST['booking_id'], 'i', 'bookings', $keys, $values, 'i');
         //confirmation email
         $emailer->OnlinePaymentEmail($data);
     }