%PDF- %PDF-
Direktori : /var/www/html/buggydubrovnik.com/premium-booking/ |
Current File : /var/www/html/buggydubrovnik.com/premium-booking/preview.php |
<?php include($_SERVER["DOCUMENT_ROOT"]."/buggy-booking/checkPromo.php"); function formatMoney($number, $cents = 1) { // cents: 0=never, 1=if needed, 2=always if (is_numeric($number)) { // a number if (!$number) { // zero $money = ($cents == 2 ? '0.00' : '0'); // output zero } else { // value if (floor($number) == $number) { // whole number $money = number_format($number, ($cents == 2 ? 2 : 0)); // format } else { // cents $money = number_format(round($number, 2), ($cents == 0 ? 0 : 2)); // format } // integer or decimal } // value $money = str_replace(",","[]", $money); $money = str_replace(".",",", $money); $money = str_replace("[]",".", $money); return $money; } // numeric } // formatMoney if(!(isset($_POST["CustomerEmail"]))) {exit;} $servername = "localhost"; $username="buggydubrovnik_app_production"; $password="appr-17"; $db="buggydubrovnik_app_production"; //$username="root"; //$password=""; // Create connection $conn = mysqli_connect($servername, $username, $password, $db); mysqli_query($conn,"set names 'utf8'"); $title = mysqli_real_escape_string($conn, $_POST["title"]); $CustomerFirstname =mysqli_real_escape_string($conn, $_POST["CustomerFirstname"]); $CustomerSurname =mysqli_real_escape_string($conn, $_POST["CustomerSurname"]); $CustomerAddress =mysqli_real_escape_string($conn, $_POST["CustomerAddress"]); $CustomerCity =mysqli_real_escape_string($conn, $_POST["CustomerCity"]); $CustomerZIP = mysqli_real_escape_string($conn, $_POST["CustomerZIP"]); $CustomerCountry =mysqli_real_escape_string($conn, $_POST["CustomerCountry"]); $CustomerPhone =mysqli_real_escape_string($conn, "+".$_POST["CustomerCode"]."-".$_POST["CustomerPhone"]); $CustomerEmail =mysqli_real_escape_string($conn, $_POST["CustomerEmail"]); $termin=$conn->real_escape_string($_POST["date"]." ".$conn->real_escape_string($_POST["vrijeme"]).":00"); $start=$termin; $end=date("Y-m-d H:i:s", strtotime("+2 hours", strtotime($start))); //+1 hour $seats=$conn->query("SELECT SUM(r.resurs) FROM rezervacija r JOIN izlet_termin t ON t.id_izlet_termin=r.id_izlet_termin WHERE r.aktivan=1 AND r.id_vozilo_tip=4 AND r.id_izlet_tip=1 AND t.aktivan=1 AND t.termin < STR_TO_DATE('$end', '%Y-%m-%d %H:%i:%s') AND r.datum_kupnja > STR_TO_DATE('$start', '%Y-%m-%d %H:%i:%s')"); $seats=$seats->fetch_row(); $seats2=$conn->query("SELECT (SUM(r.odrasli)+SUM(r.djeca)) FROM rezervacija r JOIN izlet_termin t ON t.id_izlet_termin=r.id_izlet_termin WHERE r.aktivan=1 AND t.aktivan=1 AND r.id_izlet_tip=2 and r.id_vozilo_tip=4 AND t.termin < STR_TO_DATE('$end', '%Y-%m-%d %H:%i:%s') AND r.datum_kupnja > STR_TO_DATE('$start', '%Y-%m-%d %H:%i:%s')"); // echo $sql; $seats2=$seats2->fetch_row(); $seatsRest=$seats2[0]%3!=0?3-($seats2[0]%3):0; $seats2=ceil($seats2[0]/3); $seats[0]=$seats[0]+$seats2; //DRZAVA JE ID!! $drzavaID=$CustomerCountry; $drzava=$conn->query("SELECT * FROM drzava WHERE id_drzava=".$drzavaID)->fetch_assoc(); $CustomerCountry=$drzava["naziv"]; if ($djeca == '') $djeca = 0; $promo =mysqli_real_escape_string($conn, $_POST["promo"]); $promo_id =0; $odrasli =mysqli_real_escape_string($conn, $_POST["odrasli"]); $vehicles=ceil(intval($odrasli)/3); if($vehicles!=$_POST["vehicles"]) die("Request has been tampered with."); $djeca =mysqli_real_escape_string($conn, $_POST["djeca"]); //$seatsOK=(5-$seats[0])*3>=intval($odrasli); $seatsOK=true; $komentar =mysqli_real_escape_string($conn, $_POST["komentar"]); $picktime =mysqli_real_escape_string($conn, $_POST["picktime"]); $mjeseci =mysqli_real_escape_string($conn, $_POST["mjeseci"]); $dani =mysqli_real_escape_string($conn, $_POST["dani"]); $TotalAmount=0.0; $djecau=0; $today = date("Y-m-d H:i:s"); $ShopId=10001428; $SecretKey="xIj78UUpQ0J78+eTHR]m|p6?p"; $price=1800; $discount=0; $promoCheck=checkPromo($promo); if($promoCheck) { $discount=$promoCheck["iznos"]; $promo_id=$promoCheck["id_promo_kod"]; } $priceWithoutDiscount=0.00; $cijenaOdrasli=$vehicles*$price; $priceWithoutDiscount+=$cijenaOdrasli; $cijenaOdrasli=$cijenaOdrasli-($cijenaOdrasli*$discount/100); $TotalAmount= $cijenaOdrasli; $gateWay="https://pgw.ht.hr/services/payment/api/authorize-form"; $naziv="Buggy Safari Premium Tour"; $mjestoKupljenja=mysqli_real_escape_string($conn,$_POST["mjesto_kupljenja"]); $TotalAmountV2=$TotalAmount*100; $sql="INSERT INTO rezervacija_temp VALUES (NULL, 0, '$naziv', '$termin', '$promo', '$promo_id', $odrasli, 0, 0, $cijenaOdrasli, 0, '$mjestoKupljenja', '$title', '$CustomerFirstname', '$CustomerSurname', '$CustomerAddress', '$CustomerZIP', '$CustomerCity', $drzavaID, '$CustomerPhone', '$CustomerEmail', '$today', '$komentar', 0, '', 0, 1)"; $conn->query($sql); echo $conn->error; $idtemprezervacija=$conn->insert_id; $conn->query("UPDATE rezervacija_temp SET broj_voucher=".$idtemprezervacija." WHERE id_rezervacija_temp=".$idtemprezervacija); $ShoppingCartId=$idtemprezervacija; $Signature=""; $failURL="http://www.buggydubrovnik.com"; $successURL="http://www.buggydubrovnik.com/premium-tour-thank-you/"; //$Signature=openssl_digest("authorize-form".$SecretKey.$ShopId.$SecretKey.$ShoppingCartId.$SecretKey.$TotalAmountV2.$SecretKey."1".$SecretKey."en".$SecretKey."GET".$SecretKey."http://www.adriatic-explore.com/booking/thankyouv3.php?idtemprezervacija=".$idtemprezervacija.$SecretKey."http://www.adriatic-explore.com".$SecretKey,"SHA512"); $Signature = openssl_digest("authorize-form".$SecretKey.$ShopId.$SecretKey.$ShoppingCartId.$SecretKey.$TotalAmountV2.$SecretKey."1".$SecretKey."en".$SecretKey."GET".$SecretKey.$successURL.$SecretKey.$failURL.$SecretKey.$CustomerFirstname.$SecretKey.$CustomerSurname.$SecretKey.$CustomerAddress.$SecretKey.$CustomerCity.$SecretKey.$CustomerZIP.$SecretKey.$CustomerCountry.$SecretKey.$CustomerPhone.$SecretKey.$CustomerEmail.$SecretKey."1".$SecretKey, "SHA512"); //.$naziv." (".$odrasli." + ".$djecau." people)".$SecretKey. $datParts=explode(" ", $termin); $termin=date("d.M.Y H:i", strtotime($termin)); if($seatsOK) { ?> <style> #datum { max-width: 250px; } .drzave{width: 400px;} iframe{border: 1px solid #d2d2d2;width:100%; height:200px; overflow:scroll;} .section.group { width: 90%; margin: 0 auto; max-width: 500px; } .section.group input { max-width: 400px; } textarea { width: 400px; height: 150px; } input, select, option, textarea { color:#747474; padding: 0.2em; } @media only screen and (max-width: 800px){ iframe{-webkit-overflow-scrolling:touch} .section.group {width: 100%} textarea {width: 100%;} .drzave{width: 100%;} } h2 { color: #f58220!important; font-size: 1.7em!important; } </style> <div id="wrapper"> <div id="maincontentcontainer"> <div id="maincontent"> <div class="section group"> <div id="naslov1"> <h1 style="margin-bottom:25px; text-transform:uppercase">You're just a click away from your adventure!</h1> <?php if($promoCheck) { ?> <h2>Congratulations, you just saved <?=$promoCheck["iznos"]?>% total by using a promo code!</h2> <?php } else { ?> <!-- <h2>Congratulations, you just saved 5% by booking online!</h2>--> <?php }?> </div> </div> <div class="section group" style="margin-bottom:25px; margin-top:5px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:25px;"> <b>PLEASE CHECK SUBMITTED DATA ONE MORE TIME:</b></div> <form name="f1" id="forma" style="font-weight:normal; text-align:left" action="<?=$gateWay?>" method=POST> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Excursion: </div><div class="col span_3_of_4"><input readonly class="inputtekst" name="nazivizlet" type="text" value="<?php echo $naziv; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Number of vehicles:</div><div class="col span_3_of_4"><b><?=$vehicles?> </div> </div> <div class="section group" style="margin-bottom:5px; margin-top:15px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"><strong> PERSONAL DATA</strong> </div> <div class="section group" style="margin-bottom:15px; margin-top:5px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Title: </div><div class="col span_3_of_4"> <input class="inputtekst" name="title" type="text" readonly style="width:75px;" value="<?php echo $title; ?>"/> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">First name : </div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_first_name" type="text" readonly value="<?php echo $CustomerFirstname; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Last name : </div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_last_name" type="text" readonly value="<?php echo $CustomerSurname ; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Address :</div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_street" type="text" readonly value="<?php echo $CustomerAddress; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">City :</div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_city" type="text" readonly value="<?php echo $CustomerCity; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">ZIP Code :</div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_post_code" type="text" readonly value="<?php echo $CustomerZIP; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4">Country :</div><div class="col span_3_of_4"><input class="inputtekst drzave" name="pgw_country" type="text" readonly value="<?php echo $CustomerCountry; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Telephone : </div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_telephone" type="text" readonly value="<?php echo $CustomerPhone; ?>" /></div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> E-mail : </div><div class="col span_3_of_4"><input class="inputtekst" name="pgw_email" type="text" readonly value="<?php echo $CustomerEmail; ?>" /></div></div> <input type="hidden" name="pgw_failure_url" value="<?=$failURL?>"> <input type="hidden" name="pgw_success_url" value="<?=$successURL?>"> <input type="hidden" name="pgw_shop_id" value="<?=$ShopId?>"> <input type="hidden" name="pgw_order_id" value="<?=$ShoppingCartId ?>"> <input type="hidden" name="pgw_amount" value="<?php echo $TotalAmountV2 ?>"> <input type="hidden" name="pgw_authorization_type" value="1"> <input type="hidden" name="pgw_language" value="en"> <input type="hidden" name="pgw_return_method" value="GET"> <input type="hidden" name="pgw_signature" value="<?php echo $Signature ?>"> <input type="hidden" name="pgw_disable_installments" value="1"> <input type="hidden" name="DebugMode" value="on"> <!-- <input type="hidden" name="pgw_order_info" value="<?php echo $naziv.' ('.$odrasli.' + '.$djecau.' people)'; ?>"> --> <div class="section group" style="margin-bottom:5px; margin-top:15px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"><strong> Excursion data</strong> </div> <div class="section group" style="margin-bottom:15px; margin-top:5px; background-color:#003; height:2px;"></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Date & Time :</div> <div class="col span_3_of_4"> <input class="inputtekst" name="odkad" type="text" readonly value="<?=$termin?>"/> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Persons: </div><div class="col span_3_of_4"> <input class="inputtekst" name="odrasli" type="text" readonly value="<?php echo $odrasli; ?>" /> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Pickup location: </div><div class="col span_3_of_4"> <input class="inputtekst" type="text" readonly value="<?=$mjestoKupljenja?>" /> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> Comment:</div><div class="col span_3_of_4"> <textarea class="inputtekst" style="width:100%; font-family:Arial, Helvetica, sans-serif; min-height:100px; text-align:left;" name="komentar" readonly><?php echo $komentar; ?></textarea> </div></div> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> <b>TOTAL AMOUNT <?=$promoCheck?"WITHOUT DISCOUNT":""?></b></div><div class="col span_3_of_4"> <input class="inputtekst" type="text" readonly style=" text-align:left; font-weight:bold;" name="iznostotal" value="<?php echo formatMoney($priceWithoutDiscount,2); ?> HRK" /> </div></div> <?php if($promoCheck) { ?> <div class="section group" style="margin-bottom:5px;"> <div class="col span_1_of_4"> <b>TOTAL AMOUNT WITH DISCOUNT</b></div><div class="col span_3_of_4"> <input class="inputtekst" type="text" readonly style=" text-align:left; color:#F72A5D; font-weight:bold;" name="iznostotal" value="<?php echo formatMoney($TotalAmount,2); ?> HRK" /> </div></div> <?php } ?> <div class="section group" style="margin-bottom:5px;"> <br /> <img src="http://www.buggydubrovnik.com/wp-content/uploads/2017/03/backicon.png" style="border:none; cursor:pointer;vertical-align:middle " onclick="history.go(-1)" /> <a style="vertical-align: middle;margin-left: 0.5em;color:black; font-size:1.2em;" >GO BACK AND CHANGE DETAILS</a><br /><br /></div> <div class="section group" style="margin-bottom:5px;"><b>NOTE</b>:<br /> We recommend booking and paying online - Your place is then guaranteed!<br /> Due to restricted number of people on each tour/excursion it's best to reserve Your place as soon as possible.</div> <div class="section group" style="margin-bottom:5px; margin-top:15px; "> <input class="fusion-button button-3d button-round button-xlarge button-orange button-1" type="submit" value="CONTINUE TO SECURE PAY ONLINE" onclick="return true;" style="font-size:0.9em; cursor:pointer; padding-top:10px; padding-bottom:10px; height:50px;" /> </div> <div class="section group" style="margin-bottom:5px; text-align:center; margin-top:5px;"><br /><img src="http://www.buggydubrovnik.com/wp-content/uploads/2017/03/trust.png" /> <img src="http://www.buggydubrovnik.com/wp-content/uploads/2017/03/karticebig.png" /> <img src="http://www.buggydubrovnik.com/wp-content/uploads/2017/03/trcom.png" /></div> </form> </div> </div> </div> <?php } else { ?> <div> <h1>There are not enough free seats for this tour. Please try another date or time.</h1> <div class="section group" style="margin-bottom:5px;"> <br /> <img src="http://www.buggydubrovnik.com/wp-content/uploads/2017/03/backicon.png" style="border:none; cursor:pointer;vertical-align:middle " onclick="history.go(-1)" /> <a style="vertical-align: middle;margin-left: 0.5em;color:black; font-size:1.2em;" >GO BACK AND CHANGE DETAILS</a><br /><br /></div> </div> <?php }