} if (!is_present($card_number)) { display_error('Card number is required.'); } elseif (!is_valid_card_number($card_number, $card_type)) { display_error('Card number ending in ' . substr($card_number, -4) . ' is invalid.'); } if (!is_present($card_cvv)) { display_error('Card CVV is required.'); } elseif (!is_valid_card_cvv($card_cvv, $card_type)) { display_error('Card CVV is invalid.'); } if (!is_present($card_expires)) { display_error('Card expiration date is required.'); } elseif (!is_valid_card_expires($card_expires)) { display_error('Card expiration date is invalid.'); } $order_id = add_order($card_type, $card_number, $card_cvv, $card_expires); foreach ($cart as $product_id => $item) { $item_price = $item['list_price']; $discount = $item['discount_amount']; $quantity = $item['quantity']; add_order_item($order_id, $product_id, $item_price, $discount, $quantity); } clear_cart(); sendConfirmEmail($order_id); redirect('../account?action=view_order&order_id=' . $order_id); break; default: display_error('Unknown cart action: ' . $action); break; }
if ($hid === -1) { errorDatabase(); } //Then create the Reservering $rid = getReservering($area, $startSTR, $endSTR, $aantalPers); if ($rid === -1) { errorDatabase(); } //Then create the link between de verhuurder and the reservering (the actual verhuring) createVerhuring($hid, $rid, $groep); $hashEmail = getConfirm($hid, $rid); if ($hashEmail === "error") { errorDatabase(); } //Then send confirmation email to verhuurder with confirm string sendConfirmEmail($mail, $contact, $hashEmail, $naam, $startSTR, $endSTR, $aantalPers); //Indicate succes if (!$alreadyReserved) { succesfullReservation(); } else { succesfullReservationAlreadyReserved(); } } else { //one of the fields was not set in the POST request missingData(); } /** * Shows the incomplete message and exits this script */ function incompleteData($invalidData) {