%PDF- %PDF-
Direktori : /proc/thread-self/root/var/www/html/buggydubrovnik.com/bookingv2/ |
Current File : //proc/thread-self/root/var/www/html/buggydubrovnik.com/bookingv2/save.php |
<?php require $_SERVER["DOCUMENT_ROOT"]."/bookingv2/functions.php"; $db=getDB(); $tour=getTour($_POST["id_izlet_tip"]); $datum=$_POST["date"]; $vrijeme=$_POST["vrijeme"]; $termin=$datum." ".$vrijeme.":00"; $id_izlet_tip=$tour["id_izlet_tip"]; $terminRow=$db->query("SELECT id_izlet_termin FROM izlet_termin WHERE id_izlet_tip=$tour[id_izlet_tip] AND termin='$termin' AND aktivan=1"); if($terminRow->num_rows==0||$tour["privatni"]){ $id_izlet_termin=insertRow($db, "izlet_termin", compact('termin', 'id_izlet_tip')); } else { $id_izlet_termin=$terminRow->fetch_row()[0]; } if(!$id_izlet_termin) die("Couldn't create a date."); $times=getTimes($id_izlet_tip, $datum); if(!isset($times[$vrijeme])){ die("Time not available."); } $limit=$times[$vrijeme]; $odrasli=$_POST["odrasli"]; $checkAmount=$tour["privatni"]?ceil($odrasli/PEOPLE_PER_BUGGY):$odrasli; if($checkAmount>$limit){ die("There's not enough available seats."); } $izlet_naziv=$tour["naziv"]; $vrijeme_izleta=$termin; $cijena_odrasli=$checkAmount*$tour["cijena"]; $cijena_djeca=0; $title=$_POST["title"]; $ime=$_POST["CustomerFirstname"]; $prezime=$_POST["CustomerSurname"]; $adresa=$_POST["CustomerAddress"]; $grad=$_POST["CustomerCity"]; $zip=$_POST["CustomerZIP"]; $id_drzava=$_POST["CustomerCountry"]; $telefon=$_POST["CustomerPhone"]; $mail=$_POST["CustomerEmail"]; $datum_kupnja=date("Y-m-d H:i:s"); $napomena_gost=$_POST["komentar"]; $resurs=$checkAmount; $pickup_location=$tour["privatni"]?$_POST["pickup_location"]:""; $id_rezervacija_temp=insertRow($db, 'rezervacija_temp', compact( 'id_izlet_termin', "izlet_naziv", "vrijeme_izleta", "odrasli", "cijena_odrasli", "title", "ime", "prezime", "adresa", "zip", "grad", "id_drzava", "telefon", "mail", "datum_kupnja", "napomena_gost", "resurs", "pickup_location" )); if($id_rezervacija_temp) { $db->query("UPDATE rezervacija_temp SET broj_voucher=$id_rezervacija_temp WHERE id_rezervacija_temp=$id_rezervacija_temp"); header("Location: /booking-preview?id=".$id_rezervacija_temp); die(); } else { die("Couldn't save the reservation. Please contact us directly :("); }