hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
easy3158
/
domains
/
ekwiatki.pl
/
public_html
/
Upload FileeE
HOME
<?php include("inc/head.php"); //----------------------------- require_once 'inc/payu/lib/openpayu.php'; require_once 'inc/payu/examples/config.php'; ?> <body> <!-- header start --> <?php include("inc/top.php"); ?> <!--====================================================--> <div class="breadcrumb-area gray-bg"> <div class="container"> <div class="breadcrumb-content"> <ul> <li><a href="index">ekwiatki.pl</a></li> <li class="active">Zamówienie</li> </ul> </div> </div> </div> <!-- my account start --> <div class="shop-page-area pt-75 pb-75"> <div class="container"> <div class="row flex-row-reverse"> <div class="col-lg-12"> <div class="grid-list-product-wrapper"> <div class="product-grid product-view pb-20"> <CENTER><h3>Składanie zamówienia</h3></CENTER> <CENTER><img src="assets/images/loading.gif" style="max-width: 240px;"></CENTER> <CENTER><h5>Za chwilę zostaniesz przekierowany do strony płatności...</h5></CENTER> <?php //=============================================================================== $qLatestNumID = mysqli_query($connect,"SELECT * FROM `orders` ORDER BY `numeric_id` DESC LIMIT 1"); $nLatestNumID = mysqli_num_rows($qLatestNumID); if($nLatestNumID > 0){ $sLatestNumID = mysqli_fetch_array($qLatestNumID); $newNumID = $sLatestNumID['numeric_id'] + 1; } else {$newNumID = "22101";} //=============================================================================== $total = trim(addslashes(strip_tags($_POST['total']))); $orderHash = sha1(md5(time().rand(99999,999999999))); $dataZamowienia = date("Y-m-d H:i"); $rabat = trim(addslashes(strip_tags($_POST['rabat']))); $rabatKwota = trim(addslashes(strip_tags($_POST['rabatKwota']))); $koszt_dostawy = trim(addslashes(strip_tags($_POST['koszt_dostawy']))); //-------------------------------------- $createAccount = trim(addslashes(strip_tags($_POST['createAccount']))); if(empty($createAccount)){$createAccount = "0";} $pass = trim(addslashes(strip_tags($_POST['pass']))); if(!empty($pass)){$pass = sha1(md5($pass));} $uwagi = trim(addslashes(strip_tags($_POST['uwagi']))); $data_doreczenia = trim(addslashes(strip_tags($_POST['data_doreczenia']))); $godzina_doreczenia = trim(addslashes(strip_tags($_POST['godzina_doreczenia']))); $liscik = trim(addslashes(strip_tags($_POST['liscik']))); $odbiorca_imie = trim(addslashes(strip_tags($_POST['imie']))); $odbiorca_nazwisko = trim(addslashes(strip_tags($_POST['nazwisko']))); $odbiorca_firma = trim(addslashes(strip_tags($_POST['nazwa_firmy']))); $odbiorca_ulica = trim(addslashes(strip_tags($_POST['ulica']))); $odbiorca_nr_domu = trim(addslashes(strip_tags($_POST['nr_domu']))); $odbiorca_zip = trim(addslashes(strip_tags($_POST['zip']))); $odbiorca_miasto = trim(addslashes(strip_tags($_POST['miasto']))); $odbiorca_telefon = trim(addslashes(strip_tags($_POST['telefon']))); $odbiorca_email = trim(addslashes(strip_tags($_POST['email']))); $nadawca_imie = trim(addslashes(strip_tags($_POST['nadawca_imie']))); $nadawca_nazwisko = trim(addslashes(strip_tags($_POST['nadawca_nazwisko']))); $nadawca_ulica = trim(addslashes(strip_tags($_POST['nadawca_ulica']))); $nadawca_nr_domu = trim(addslashes(strip_tags($_POST['nadawca_nr_domu']))); $nadawca_zip = trim(addslashes(strip_tags($_POST['nadawca_zip']))); $nadawca_miasto = trim(addslashes(strip_tags($_POST['nadawca_miasto']))); $nadawca_telefon = trim(addslashes(strip_tags($_POST['nadawca_telefon']))); $nadawca_email = trim(addslashes(strip_tags($_POST['nadawca_email']))); $faktura = trim(addslashes(strip_tags($_POST['faktura']))); if(empty($faktura)){$faktura = "0";} $faktura_nazwa = trim(addslashes(strip_tags($_POST['faktura_nazwa']))); $faktura_nip = trim(addslashes(strip_tags($_POST['faktura_nip']))); $faktura_ulica = trim(addslashes(strip_tags($_POST['faktura_ulica']))); $faktura_nr_domu = trim(addslashes(strip_tags($_POST['faktura_nr_domu']))); $faktura_zip = trim(addslashes(strip_tags($_POST['faktura_zip']))); $faktura_miasto = trim(addslashes(strip_tags($_POST['faktura_miasto']))); //=============================================================================== $q = mysqli_query($connect,"SELECT * FROM `cart` WHERE `user_hash` = '".$_SESSION['user_hash']."'"); $n = mysqli_num_rows($q); if($n > 0){ $totalProdukty = 0; while($s = mysqli_fetch_array($q)){ $cart_product_id = $s['product_id']; $cart_ilosc = $s['ilosc']; $cart_kwota = $s['kwota']; $totalProdukty += $cart_kwota; $cart_waluta = $s['waluta']; $cart_rozmiar = $s['rozmiar']; $cart_dodatek = $s['dodatek']; $cart_kreator = $s['kreator']; $cart_kreator_dlugosc = $s['kreator_dlugosc']; $cart_kreator_liczba = $s['kreator_liczba']; $cart_kreator_przybranie = $s['kreator_przybranie']; $cart_kreator_ulozenie = $s['kreator_ulozenie']; $cart_kreator_kolor = $s['kreator_kolor']; //------------------------------------------ if($cart_dodatek == "0"){ $qSellCount = mysqli_query($connect,"SELECT * FROM `products` WHERE `id` = $cart_product_id"); $sSellCount = mysqli_fetch_array($qSellCount); $sell_countSellCount = $sSellCount['sell_count']; $newSellCountSellCount = $sell_countSellCount + 1; mysqli_query($connect,"UPDATE `products` SET `sell_count` = '$newSellCountSellCount' WHERE `id` = $cart_product_id"); } //---------------------------------------------------------- mysqli_query($connect,"INSERT INTO `orders` (`user_hash`, `product_id`, `ilosc`, `kwota`, `waluta`, `rozmiar`, `dodatek`, `kreator`, `kreator_dlugosc`, `kreator_liczba`, `kreator_przybranie`, `kreator_ulozenie`, `kreator_kolor`, `kwota_total`, `kwota_dostawy`, `odbiorca_imie`, `odbiorca_nazwisko`, `odbiorca_firma`, `odbiorca_adres`, `odbiorca_zip`, `odbiorca_miasto`, `odbiorca_telefon`, `odbiorca_email`, `doreczenie_data`, `doreczenie_godzina`, `uwagi`, `liscik`, `nadawca_imie`, `nadawca_nazwisko`, `nadawca_adres`, `nadawca_zip`, `nadawca_miasto`, `nadawca_telefon`, `nadawca_email`, `faktura`, `faktura_nazwa`, `faktura_nip`, `faktura_adres`, `faktura_zip`, `faktura_miasto`, `order_hash`, `data`,`paid`,`removed`,`rabat`,`numeric_id`) VALUES ('".$_SESSION['user_hash']."', '$cart_product_id', '$cart_ilosc', '$cart_kwota', '$moja_waluta', '$cart_rozmiar', '$cart_dodatek', '$cart_kreator', '$cart_kreator_dlugosc', '$cart_kreator_liczba', '$cart_kreator_przybranie', '$cart_kreator_ulozenie', '$cart_kreator_kolor', '$total', '$koszt_dostawy', '$odbiorca_imie', '$odbiorca_nazwisko', '$odbiorca_firma', '$odbiorca_ulica $odbiorca_nr_domu', '$odbiorca_zip', '$odbiorca_miasto', '$odbiorca_telefon', '$odbiorca_email', '$data_doreczenia', '$godzina_doreczenia', '$uwagi', '$liscik', '$nadawca_imie', '$nadawca_nazwisko', '$nadawca_ulica $nadawca_nr_domu', '$nadawca_zip', '$nadawca_miasto', '$nadawca_telefon', '$nadawca_email', '$faktura', '$faktura_nazwa', '$faktura_nip', '$faktura_ulica $faktura_nr_domu', '$faktura_zip', '$faktura_miasto', '$orderHash', '$dataZamowienia','0','0','$rabat','$newNumID');"); //---------------------------------------------------------- if(!empty($_SESSION['user_id'])){extrapoints($_SESSION['user_id'],$shopping_pointsPOINTS,"Punkty przyznane za zakupy w sklepie");} //------------------------------------------ $mail->Subject = "Przyjecie zamowienia nr $newNumID";//temat maila $mail->AddEmbeddedImage("assets/images/logo.png", "baner1", "logo.png", "base64"); $text_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body style="padding: 0px; margin: 0px;"> <div style="padding: 10px; background: #4b0c31; font-family: Arial;"> <div style="padding: 10px; background: #fff; font-family: Arial;"> '; $text_body .= '<BR><CENTER><img src="cid:baner1" style="margin-bottom: 10px;" /></CENTER><BR><BR>'; $text_body .= "Witaj, $nadawca_imie!<BR>Potwierdzamy przyjęcie zamówienia o numerze <B>$newNumID</B> na kwotę <B>$total $moja_waluta.</B><BR>Zamówienie zostanie zrealizowane niezwłocznie po otrzymaniu płatności."; $text_body .= "<BR><BR>Pozdrawiamy!<BR><B>Kwiaciarnia Pełna Marzeń</B><BR><BR>biuro@ekwiatki.pl<BR>www.ekwiatki.pl"; $text_body .= "</div><div style='clear: both; height: 4px;'></div><div style='float: right; color: #fff; font-family: Arial; padding-top: 5px;'>ekwiatki.pl</div><div style='clear: both; height: 4px;'></div></div></body></html>"; $mail->Body = $text_body; // adresatów dodajemy poprzez metode 'AddAddress' $mail->AddAddress($nadawca_email,"Kwiaciarnia Pelna Marzen"); $mail->AddAddress($emailContact,"Kwiaciarnia Pelna Marzen"); if(!$mail->Send()) echo $mail->ErrorInfo; // Clear all addresses and attachments $mail->ClearAddresses(); $mail->ClearAttachments(); //------------------------------------------ } //=============================================================================== // EXTRA POINTS FOR EVERY 50 PLN $kazde5dyszek = floor($totalProdukty / 50); if($kazde5dyszek >= 1){ $punkty5dyszek = $kazde5dyszek * $spent50_pointsPOINTS; if(!empty($_SESSION['user_id'])){extrapoints($_SESSION['user_id'],$punkty5dyszek,"Punkty przyznane za każde wydane 50 ".$moja_waluta." na produkty");} } //=============================================================================== // EXTRA POINTS FOR NEW ORDER WITHIN 14 DAYS $q14daysOrder = mysqli_query($connect,"SELECT * FROM `orders` WHERE `user_hash` = '".$_SESSION['user_hash']."' AND `order_hash` != '$orderHash' ORDER BY `data` DESC LIMIT 1"); $n14daysOrder = mysqli_num_rows($q14daysOrder); if($n14daysOrder > 0){ $s14daysOrder = mysqli_fetch_array($q14daysOrder); $data14daysOrder = $s14daysOrder['data']; $licz14Days = 60*60*24*14; if(strtotime(date("Y-m-d H:i")) - strtotime($data14daysOrder) <= $licz14Days){ if(!empty($_SESSION['user_id'])){extrapoints($_SESSION['user_id'],$nextorder_pointsPOINTS,"Punkty przyznane za kolejne zamówienie w ciągu 14 dni");} } } //=============================================================================== if(!empty($_SESSION['user_id'])){ $qSpentCount = mysqli_query($connect,"SELECT * FROM `users` WHERE `id` = ".$_SESSION['user_id']); $sSpentCount = mysqli_fetch_array($qSpentCount); $spent_count = $sSpentCount['spent_count']; $newSpentCount = $spent_count + $total; mysqli_query($connect,"UPDATE `users` SET `spent_count` = '$newSpentCount' WHERE `id` = ".$_SESSION['user_id']); } //=============================================================================== // DID USER USE HIS DISCOUNT VIA POINTS? if($rabat == "1"){ $usedPoints = $rabatKwota * $spentrabat_pointsPOINTS; /*$qUsedPointsUserData = mysqli_query($connect,"SELECT * FROM `users` WHERE `id` = ".$_SESSION['user_id']); $sUsedPointsUserData = mysqli_fetch_array($qUsedPointsUserData); $actualPoints_usedPoints = $sUsedPointsUserData['points']; $newPoints_usedPoints = $actualPoints_usedPoints - $usedPoints; mysqli_query($connect,"UPDATE `users` SET `points` = '$newPoints_usedPoints' WHERE `user_id` = ".$_SESSION['user_id']);*/ if(!empty($_SESSION['user_id'])){extrapoints($_SESSION['user_id'],'-'.$usedPoints,"Punkty wykorzystane w procesie zakupu - rabat na produkty w sklepie");} if(!empty($_SESSION['user_id'])){extrapoints($_SESSION['user_id'],$usepoints_pointsPOINTS,"Punkty przyznane za wykorzystanie rabatu w koszyku");} } //=============================================================================== if($createAccount == "1"){ if(mysqli_num_rows(mysqli_query($connect,"SELECT * FROM `users` WHERE `email` = '$nadawca_email'")) == 0){ $qNewID = mysqli_query($connect,"SELECT * FROM `users` ORDER BY `id` DESC LIMIT 1"); $nNewID = mysqli_num_rows($qNewID); if($nNewID > 0){ $sNewID = mysqli_fetch_array($qNewID); $newID = $sNewID['id'] + 1; } else {$newID = 1;} mysqli_query($connect,"INSERT INTO `users` (`id`,`email`, `password`, `telefon`, `imie`, `nazwisko`, `ulica`, `nr_domu`, `nr_lokalu`, `zip`, `miasto`, `firma_nazwa`, `firma_nip`, `firma_ulica`, `firma_nr_domu`, `firma_nr_lokalu`, `firma_zip`, `firma_miasto`, `active_code`, `active`, `hash`,`notifs_newsletter`,`notifs_points`,`points`,`data`) VALUES ('$newID','$nadawca_email','$pass','$nadawca_telefon','$nadawca_imie', '$nadawca_nazwisko','','','','','','','','','','','','','".rand(1111,9999)."','1', '".$_SESSION['user_hash']."','1','1','$register_pointsPOINTS','".date("Y-m-d H:i")."');"); mysqli_query($connect,"INSERT INTO `points_history` (`user_id`,`data`,`opis`,`points`) VALUES ('$newID','".date("Y-m-d H:i")."','Punkty otrzymane za rejestrację w naszym sklepie internetowym!','$register_pointsPOINTS')"); //------------------------------------------ $mail->Subject = "ekwiatki.pl - Rejestracja";//temat maila $mail->AddEmbeddedImage("assets/images/logo.png", "baner1", "logo.png", "base64"); $text_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </head> <body style="padding: 0px; margin: 0px;"> <div style="padding: 10px; background: #4b0c31; font-family: Arial;"> <div style="padding: 10px; background: #fff; font-family: Arial;"> '; $text_body .= '<BR><CENTER><img src="cid:baner1" style="margin-bottom: 10px;" /></CENTER><BR><BR>'; $text_body .= "Witaj, $nadawca_imie!<BR>Dziękujemy za założenie konta w serwisie ekwiatki.pl!<BR><BR>W prezencie otrzymujesz od nas na start <B>$register_pointsPOINTS punktów</B>.<BR>Zaloguj się do swojego profilu i dowiedz się, jak działają punkty."; $text_body .= "<BR><BR>Pozdrawiamy!<BR><B>Kwiaciarnia Pełna Marzeń</B><BR><BR>biuro@ekwiatki.pl<BR>www.ekwiatki.pl"; $text_body .= "</div><div style='clear: both; height: 4px;'></div><div style='float: right; color: #fff; font-family: Arial; padding-top: 5px;'>ekwiatki.pl</div><div style='clear: both; height: 4px;'></div></div></body></html>"; $mail->Body = $text_body; // adresatów dodajemy poprzez metode 'AddAddress' $mail->AddAddress($nadawca_email,"Kwiaciarnia Pelna Marzen"); if(!$mail->Send()) echo $mail->ErrorInfo; // Clear all addresses and attachments $mail->ClearAddresses(); $mail->ClearAttachments(); //------------------------------------------ } } //=============================================================================== } else {header("Location: cart");exit;} mysqli_query($connect,"DELETE FROM `cart` WHERE `user_hash` = '".$_SESSION['user_hash']."'"); //=============================================================================== // PAYU MAGIC STUFF ============================================================= //=============================================================================== if($moja_waluta == "EUR"){ $getEUR = file_get_contents("https://rss.nbp.pl/kursy/TabelaA.xml"); $kurs_euro = get_string_between($getEUR,"1 EUR =</td><td>","</td>"); $kurs_euro = str_replace(",",".",$kurs_euro); $kurs_euro = round($kurs_euro,2); $total = number_format(($total * $kurs_euro),2); } //---------------------------- $order['continueUrl'] = 'https://ekwiatki.pl/paymentSuccess'; //customer will be redirected to this page after successfull payment $order['notifyUrl'] = 'https://ekwiatki.pl/inc/payu/getStatus.php'; $order['customerIp'] = $_SERVER['REMOTE_ADDR']; $order['merchantPosId'] = OpenPayU_Configuration::getMerchantPosId(); $order['description'] = 'Opłata za zamówienie w ekwiatki.pl - '.$newNumID; $order['currencyCode'] = 'PLN'; $order['totalAmount'] = ($total * 100); $order['extOrderId'] = $orderHash; //must be unique! $order['products'][0]['name'] = 'Zamówienie'; $order['products'][0]['unitPrice'] = ($total * 100); $order['products'][0]['quantity'] = 1; //optional section buyer $order['buyer']['email'] = $nadawca_email; $order['buyer']['phone'] = $nadawca_telefon; $order['buyer']['firstName'] = $nadawca_imie; $order['buyer']['lastName'] = $nadawca_nazwisko; $response = OpenPayU_Order::create($order); header('Location:'.$response->getResponse()->redirectUri); //You must redirect your client to PayU payment summary page. //=============================================================================== ?> </div> </div> </div> </div> </div> </div> <!--====================================================--> <?php include("inc/footer.php"); ?> <!-- all js here --> <?php include("inc/footerScripts.php"); ?> </body> </html>