%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/buggydubrovnik.com/bookingv2/
Upload File :
Create Path :
Current File : /var/www/html/buggydubrovnik.com/bookingv2/thankyou.php

<?php
require $_SERVER["DOCUMENT_ROOT"]."/bookingv2/functions.php";
//pokupimo pay way podatke
$idtemprezervacija=0;
$idizlet=0;
$tid=0;
if(isset($_GET["pgw_order_id"]))
{
    $idtemprezervacija=$_GET["pgw_order_id"];

}
else die("Order ID is not set");
if(isset($_GET["pgw_transaction_id"]))
{
    $tid=$_GET["pgw_transaction_id"];

}
else die("Transaction ID not set.");
$id=$idtemprezervacija;

$con=getDB();

$sql="SELECT rt.*, d.naziv as drzava FROM rezervacija_temp rt JOIN drzava d ON d.id_drzava=rt.id_drzava WHERE id_rezervacija_temp=".$id;
$data=$con->query($sql);

if($data->num_rows!=1) die("Rezervacija ne postoji.");
$row=$data->fetch_assoc();

if($row["placeno"]==0) {
    $row["placeno"]=1;
    $row["pgw_transaction_id"]=$tid;
    $insertData=$row;
    // var_dump($insertData);
    $termin=$con->query("SELECT * FROM izlet_termin t WHERE t.id_izlet_termin=$row[id_izlet_termin]");
    if($termin->num_rows) {
        $terminRow=$termin->fetch_assoc();
        $termin=$terminRow["id_izlet_termin"];
    }
    else {
        die("Malformed date.");
    }
    $tour=getTour($terminRow["id_izlet_tip"]);
    $insertData["id_izlet_termin"]=$terminRow["id_izlet_termin"];

    $startHM=substr($insertData["vrijeme_izleta"], 11, 5);
    $endHM=addTime($startHM, $tour["trajanje"]);


    $insertData["datum_kupnja"]=date("Y-m-d H:i:s", strtotime(substr_replace($insertData["vrijeme_izleta"], $endHM, 11, 5)));

    unset($insertData["vrijeme_izleta"]);
    unset($insertData["id_rezervacija_temp"]);
    unset($insertData["izlet_naziv"]);
    unset($insertData["promo_kod"]);
    unset($insertData["placeno"]);
    unset($insertData["promo_kod"]);
    $insertData["voucher"]=$insertData["broj_voucher"];
    unset($insertData["broj_voucher"]);
    $insertData["id_tip_placanja"]=5;
    unset($insertData["drzava"]);
    $insertData["id_payway"]=$insertData["pgw_transaction_id"];
    unset($insertData["pgw_transaction_id"]);
    $insertData["id_kosarica"]=$idtemprezervacija;
    $insertData["id_prodajno_mjesto"]=6;
    $insertData["id_izlet_tip"]=$tour["id_izlet_tip"];
    $insertData["id_vozilo_tip"]=4;
    $insertData["id_promo_kod"]=0;

    $pickup_location=$insertData["pickup_location"];

    $sumaLjudi=$insertData["odrasli"]+$insertData["djeca"];
    $insertData["djeca_besplatno"]=0;
    insertRow($con, "rezervacija", $insertData);

    //TODO: REMOVE!!!
    //die("Test die.");
    $con->query("UPDATE rezervacija_temp SET placeno=1, id_payway='".$tid."' WHERE id_rezervacija_temp=".$id);

    //echo $con->error;

    $SecretKey="xIj78UUpQ0J78+eTHR]m|p6?p";
    $testsignature= openssl_digest($_GET["pgw_trace_ref"].$SecretKey.$_GET["pgw_transaction_id"].$SecretKey.$_GET["pgw_order_id"].$SecretKey.$_GET["pgw_amount"].$SecretKey.$_GET["pgw_installments"].$SecretKey.$_GET["pgw_card_type_id"].$SecretKey, "SHA512");

//echo $testsignature;

    if($_GET["pgw_signature"]==$testsignature)
    {

        $con->query("UPDATE rezervacija_temp SET id_payway='".($tid."-DA")."' WHERE id_rezervacija_temp=".$id);
    }






    require($_SERVER["DOCUMENT_ROOT"]."/buggy-booking/voucher.php");


    date_default_timezone_set('Etc/UTC');
    require $_SERVER["DOCUMENT_ROOT"].'/PHPMailer_5.2.1/PHPMailerAutoload.php';
//Create a new PHPMailer instance

    $mail     = new PHPMailer();
//Tell PHPMailer to use SMTP
    $mail->isSMTP();
    $mail->CharSet = 'UTF-8';
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
    $mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';
//Set the hostname of the mail server
    $mail->Host = "mail.buggydubrovnik.com";
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 465;
//Set the encryption system to use - ssl (deprecated) or tls
    $mail->SMTPSecure = 'ssl';
//Whether to use SMTP authentication
    $mail->SMTPAuth = true;
    $mail->Username = "info@buggydubrovnik.com";
    $mail->Password = "BuDuCo333!?";
//Set who the message is to be sent from
    $mail->SetFrom('info@buggydubrovnik.com', 'Buggy Safari');
    $mail->AddReplyTo("info@buggydubrovnik.com","Buggy Safari");
    $mail->Subject    = 'Voucher('.$id.')  - '.$row["izlet_naziv"];
    $mail->MsgHTML($html);
    $address = $row["mail"];



    $mail->AddAddress($address, $row["ime"].' '.$row["prezime"] );




    $address = 'info@buggydubrovnik.com';
    $mail->AddAddress($address, 'Buggy Safari' );
    $mail->AddBcc("leo.staric@energit.biz", 'Leo' );



    $poruka="";


    if(!$mail->Send()) {
        $mail     = new PHPMailer();
        $mail->isSMTP();
        $mail->CharSet = 'UTF-8';
        $mail->SMTPDebug = 0;
        $mail->Debugoutput = 'html';
        $mail->Host = "mail.buggydubrovnik.com";
        $mail->Port = 465;
        $mail->SMTPSecure = 'ssl';
        $mail->SMTPAuth = true;
        $mail->Username = "info@buggydubrovnik.com";
        $mail->Password = "BuDuCo333!?";
        $mail->SetFrom('info@buggydubrovnik.com', 'Buggy Safari');
        $mail->Subject    = 'Voucher  - '.$row["izlet_naziv"].'('.$row["odrasli"].'/'.$row["djeca"].')';

        $mail->MsgHTML('<p style="font-size:16px; color:#F00"> VOUCHER NIJE POSLAN KUPCU, DOSLO JE DO NEKE GRESKE </p>'.$body);
        //TODO: VRATIT OFFICE!!!
        $address = 'info@buggydubrovnik.com';
        $mail->AddAddress($address, 'Buggy Safari');
        $mail->AddBcc('leo.staric@energit.biz', "Leo Starić");
        $mail->Send();

    } else {
        $poruka="Your request has been successfully sent! Thank you!";
    }
    ?>
<!-- Google Code for Buggy Conversion Page -->
<script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = 862843962;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "VvCLCJ-toHEQuui3mwM";
    var google_remarketing_only = false;
    /* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
    <div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/862843962/?label=VvCLCJ-toHEQuui3mwM&amp;guid=ON&amp;script=0"/>
    </div>
</noscript>
<?php
}


Zerion Mini Shell 1.0