Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/koszyk2.php
<?php
session_start();
if(isset($_GET['delete'])){
    unset($_SESSION['etykietyweselne'][$_GET['delete']]);
    header('location: koszyk.php');
}
$iloscprod = count($_SESSION['etykietyweselne']);
define("WWW","http://www.etykietyslubne.pl/");    
define("CENA",7.5);                            
define("WYSYLKAPP",10);                          
define("WYSYLKAKURIER",15);



?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title> Strona główna </title>     
<?php                                                                
include('application/views/_partials/head.php');
?>                                                
    <script>
    $(document).ready(function() {    
        $('div.blur').removeClass('active');
    });
    </script> 
    
<body oncontextmenu="return false;">  
     <div class="blur">
<div id="header_top">

	<div class="stars_nice_1"></div>
	<div class="stars_nice_2"></div>
		<div class="wrapper">
			<div class="contact_box"><img src="html/tpl/images/kreator_17.png" alt=""/></div>
			<a href="#" class="logo"><img src="html/tpl/images/kreator_18.png" height="120" alt=""/></a>
			<div class="cart">
				<h2>Twój koszyk:</h2>
				<p><span style="font-size:13px;display:inline-block;position:relative;top:3px">ilosć produktów: <?php 
        if($iloscprod) echo $iloscprod;
        else echo '0';?></span>  </p>
			</div>
			<!--
			<div class="icons">
				<a href=""><img src="html/tpl/images/kreator_06.png" alt=""/></a>
				<a href=""><img src="html/tpl/images/kreator_08.png" alt=""/></a>
				<a href=""><img src="html/tpl/images/kreator_10.png" alt=""/></a>
				<a href=""><img src="html/tpl/images/kreator_12.png" alt=""/></a>
				<a href=""><img src="html/tpl/images/kreator_14.png" alt=""/></a>
			</div>
			//-->
			<br style="clear: both;"/>
			<a href="#" class="th-steps"><img src="html/tpl/images/kreator_32.png" height="20" alt=""/></a>
	
		</div>
	</div>
<div id="page">   	      
<div id="page">    
		<div id="container">
			
			<div id="content" style="width:950px">
				
				<div class="wrapper_border" style="padding:40px">
        <?php if(isset($_GET['submit'])){
                                                 
        require 'PHPMailerAutoload.php';

$mail = new PHPMailer;
                                                      
$mail->addAddress($_POST['email'], $_POST['email']);
$mail->setFrom('allegro@prolabel.pl', 'Prolabel');
//$mail->addAddress('barii@wp.pl', 'barii@wp.pl');
//$mail->addAddress('biuro@prolabel.pl', 'biuro@prolabel.pl');     // Add a recipient
  
//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail->isHTML(true);                                  // Set email format to HTML   
                                $mail->SetLanguage("pl", "classes/language/");
                                $mail->CharSet = "utf-8";



// subject
$subject = '@Etykiety Weselne dla '.$_POST['imie'].' / nick: '.$_POST['allegro'];

// message
$message = '
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
</head>
<body>
<ul style="padding:0px;margin:0px;font-size:15px">
<li style="list-style:none">Dnia '.Date("Y-m-d").'</li><li style="list-style:none">Nr kontaktowy '.$_POST['tel'].'</li>
<li style="list-style:none">Zamawiający: '.$_POST['imie'].'</li>
<li style="list-style:none">Email: '.$_POST['email'].'</li>';
if($_POST['allegro'])$message .= '<li style="list-style:none">Nick allegro '.$_POST['allegro'].'</li>';
else $message .= '<li style="list-style:none"><h3>Adres dostawy:</h3>'.$_POST['ulica'].'<br>
'.$_POST['kod'].' '.$_POST['miasto'].'</li>
<li style="list-style:none">Dostawa: '.$_POST['wysylka'].'</li>';
$message .= '
</ul><br>';
$nick = str_replace(' ','_',$_POST['allegro']);
$zip = new ZipArchive();
$filenames = 'zip/'.$nick.'-EtykietyWodka-'.Date("YmdHis").'.zip';
$zaw=0;
$sz=0;
$cena = 0 ;
if ($zip->open($filenames, ZipArchive::CREATE)!==TRUE) {
    exit("cannot open <$filenames>\n");
}
$o=0;
$ii=0;
$messaget = '<h3>Podsumowanie zamównia:</h3><table style="margin:20px 50px">';
foreach ($_SESSION['etykietyweselne'] as $val => $rel){
    $zip->addFile($rel['pdf'],$nick.'-'.$rel['wzor'].'__'.$rel['sztuk'].'szt_'.$ii.'.pdf');
    $messaget .= '<tr><td>';
    $messaget .= '<img src="'.WWW.$rel['mini'].'" style="width:60px" width="90">';
    if($rel['zawieszka']) $messaget .= '<img src="'.WWW.$rel['zawieszka'].'" style="width:60px" width="90">';      
    $messaget .= '</td><td>etykiety: '.$rel['sztuk'].' szt.<br />zawieszki: '.$rel['zawieszki'].' szt.</td></tr>';
    $cena += ($rel['sztuk']*CENA/10 + $rel['zawieszki']*CENA/10);
    $sz +=$rel['sztuk'];
    $zaw += $rel['zawieszki'];
    
$ii++;
}
$messaget .= '</table>';

$zip->close();

$message = $message.$messaget.'<p><b>Dane kontaktowe:</b><br />
Mydlana 1, 51-502 Wrocław<br />
tel. +48 512 512 661 pon-pt od 10.00 - 17.00<br />
email: biuro@prolabel.pl</p>
<p><img src="'.WWW.'/img/stopkamail.jpg"></p>
</body>
</html>';


$mail->Subject = $subject;
$mail->Body    = $message;

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo $message;
}


$mail2 = new PHPMailer;
                                                      
//$mail2->addAddress($_POST['email'], $_POST['email']);
$mail2->setFrom('allegro@prolabel.pl', 'Prolabel');
$mail2->addAddress('biuro@mfbiz.pl', 'biuro@mfbiz.pl');
$mail2->addAddress('biuro@prolabel.pl', 'biuro@prolabel.pl');     // Add a recipient
  
//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail2->isHTML(true);                                  // Set email format to HTML   
                                $mail2->SetLanguage("pl", "classes/language/");
                                $mail2->CharSet = "utf-8"; 
                                
                                
$message = '<p>PLIK DO POBRANIA: <a href="'.WWW.$filenames.'">ZIP '.$filenames.'</a></p>'.$message;


$mail2->Subject = $subject;
$mail2->Body    = $message;

if(!$mail2->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail2->ErrorInfo;
} else {
    //echo 'Message has been sent';
}
                                                           
if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl') {

require_once realpath(dirname(__FILE__)) . '/payu/lib/openpayu.php';
require_once realpath(dirname(__FILE__)) . '/payu/examples/config.php';

$order = array();

$order['notifyUrl'] = 'http://www.etykietyweselne.pl/';
$order['continueUrl'] = 'http://www.etykietyweselne.pl/koszyk.php?success';

$order['customerIp'] = '127.0.0.1';
$order['merchantPosId'] = OpenPayU_Configuration::getMerchantPosId();
$order['description'] = 'New order';
$order['currencyCode'] = 'PLN';
$order['totalAmount'] = $cena *100;
$order['extOrderId'] = uniqid('', true);

$order['products'][0]['name'] = 'Etykiety: '.$sz.' i zawieszki: '.$zaw;
$order['products'][0]['unitPrice'] = $cena *100;
$order['products'][0]['quantity'] = 1;


$order['buyer']['email'] = $_POST['email'];
$order['buyer']['phone'] = $_POST['tel'];
$order['buyer']['firstName'] = $_POST['imie'];
$order['buyer']['lastName'] = '';

$rsp = OpenPayU_Order::hostedOrderForm($order);
echo $rsp; 
 }
 
unset($_SESSION['etykietyweselne']);
$_SESSION['i']=0;

         
        }else{
          ?>
					<h1><span class="nice_text pink"><span class="cart"></span> Twój koszyk </span>  </h1>
					<br style="clear: both;"/>
           <div class="koszyk"> 
           <?php
              echo '<p class="nagl"><span class="lp">lp.</span><span class="min">miniaturka</span><span class="spec">specyfikacja</span><span class="ilosc">ilość</span>';
              if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl') echo '<span class="ilosc">cena</span>';
              echo '<span class="usun">usuń z koszyka</span></p>'; 
           $i=0;
           $suma = 0;
           foreach($_SESSION['etykietyweselne'] as $val => $rel){
              $i++;
              $cena = ($rel['sztuk']*CENA/10 + $rel['zawieszki']*CENA/10);
              $suma +=$cena;
              echo '<p><span class="lp">'.$i.'</span><span class="min butelka-'.$rel['wzor'].'"><a class="group1" href="'.$rel['mini'].'"><img src="'.$rel['mini'].'"></a>';
                    //if($rel['zawieszka']) echo '<img src="'.$rel['zawieszka'].'" class="zawieszka">';
              echo '</span><span class="spec">Wzór: '.$rel['wzor'].'</span><span class="ilosc" style="position:relative;top:15px">etykiety: '.$rel['sztuk'].' szt.<br />zawieszki: '.$rel['zawieszki'].' szt.</span>';
              if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl') echo '<span class="ilosc" style="position:relative;top:15px">'.$cena.' zł</span>';
              echo '<span class="usun"><a href="koszyk.php?delete='.$val.'">x</a></span></span></p>';           
           }
           if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl')   echo '<p class="nagl"><span class="lp">&nbsp;</span><span class="min">&nbsp;</span><span class="spec">&nbsp;</span><span class="ilosc" style="text-align:right">Suma:</span><span class="ilosc">'.$suma.' zł</span><span class="usun">&nbsp;</span></p>';
           ?>
           </div>
					<br style="clear: both;"/>
					<?php
           
          }
          ?>
          
          
                                        
				<?php if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl') {?>
        <?php
        echo '<div style="text-align:center">Płatności online obsługuje: <img src="/img/logo_0.png" style="vertical-align:middle;width:100px;margin:0 20px"></div>';
        }?>
				</div>
				</div>

			<a class="wyslij big_button">Finalizuj zamówienie</a>
			<a href="/" class="big_button blue">Dodaj następny</a>
			<br style="clear: both;"/><br style="clear: both;"/>
			
			
		</div>	
	</div>     
	</div>

  
<?php

include('application/views/_partials/frontend_footer.php');
     
?>           
	</div>
<div class="popup"><div class="overwhite"></div><div class="sendpopup"><a class="zamknij">X</a>
    <h2>Wpisz dane do zamówienia</h2>
    <form action="koszyk.php?submit" method="post">
      <p><span>Imię i Nazwisko:</span> <input type="text" name="imie" required/></p> 
      <p><span>Numer telefonu:</span> <input type="text" name="tel" required/></p>
      <p><span>Adres e-mail:</span> <input type="text" name="email" required/></p>
      <?php if($_SERVER['HTTP_HOST']=='www.etykietyweselne.pl'){?><h2>Adres dostawy:</h2>
      <p><span>Ulica i numer:</span> <input type="text" name="ulica" /></p> 
      <p style="height:30px"><span>Kod pocztowy:</span> <input type="text" name="kod" style="width:80px !important;float:left;margin-right:30px" /> <span>Miasto:</span> <input type="text" name="miasto" style="float:left;width:150px !important" /></p>    
      <p><span>Wysyłka:</span>
      <select name="wysylka">
        <option value="Odbiór Osobisty">0zł - Odbiór Osobisty (Wrocław)</option>
        <option value="Poczta Polska" selected>10zł - Poczta Polska (przedpłata)</option>
        <option value="Kurier">15zł - Kurier InPost (Przedpłata)</option>
      </select>
      </p>        
      
      
      <?php } 
      else{  ?>
            <p><span>Nick allegro:</span> <input type="text" name="allegro" required/></p>
      <?php }?>                                                                                                                             
      <button id="realizuuj" class="bt btn-next loading2 active" style="float:right;position:relative;top:0px;border-radius:5px;"/>Potwierdzam i zamawiam</button>
</form>
</div></div>

</body>
</html>