<?php
ob_start(); ## -> Oturum Başlatıldı
session_start(); ## -> Oturum Başlatıldı
include("ust.php");
date_default_timezone_set('Europe/Istanbul');


	
$verino = g("verino");
$icerik_getir=mysql_query("SELECT * FROM fiyattablosu WHERE id='$verino'"); 
$getir=mysql_fetch_array($icerik_getir); 
$id = $getir['id'];
$urun_id = $getir['id'];
$urun_baslik = $getir['baslik'];
$urun_resim = $getir['resim'];
$urun_fiyat = $getir['m5'];
$tl_formati = number_format($urun_fiyat, 2, ',', '.');
$urun_fiyat_yaz = "$tl_formati " . $dil_v_getir["dil_para"]; 

## ÜRÜNLER MODÜLÜ 
$m_kontrol=mysql_query("SELECT * FROM moduller WHERE modul_adi='fiyattablosu'"); 
$getir=mysql_fetch_array($m_kontrol); 
$modul_v6 = $getir['modul_v6'];
$modul_v7 = $getir['modul_v7'];
if($modul_v6 == "evet"){
	
	
	
?>
	
	<section class="contact-us" style="margin-top:-40px;">
	<div class="container">
			
	
	<?php
	$islem = g("islem");

	
	if($islem == "buy"){

	

	
	$type = g("type");
	$icerik_getir=mysql_query("SELECT * FROM fiyattablosu WHERE id='$type'"); 
	$getir=mysql_fetch_array($icerik_getir); 
	$urun_fiyat = $getir['m5'];
	$urun_id = $getir['id'];

	##-> İp Adresi Alma
	function getRealIpAddr()  
	{if (!empty($_SERVER['HTTP_CLIENT_IP']))  
	{$ip=$_SERVER['HTTP_CLIENT_IP']; }  
	elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //Proxy den bağlanıyorsa gerçek IP yi alır.
	{ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];}  
	else { $ip=$_SERVER['REMOTE_ADDR']; }  
	return $ip; }  


  	$siparis_adsoyad = p("siparis_adsoyad");
	$siparis_telefon = p("siparis_telefon");
	$siparis_mail = p("siparis_mail");
	$siparis_tarih = date('d.m.Y');
	$siparis_saat = date('H:i');
	$siparis_kargo = p("siparis_kargo");
	$siparis_not = p("siparis_not");
	$siparis_tutar = $urun_fiyat;
	$siparis_ip = getRealIpAddr();
	$siparis_odeme_durum = "bekliyor";
	$siparis_durum = "bekliyor";
	$siparis_tur = "paket";
	$siparis_veri = $urun_id;
	$siparis_no = rand(1111111,9999999);

	$ekle = mysql_query("INSERT INTO siparisler (siparis_no,siparis_kargo,siparis_not,siparis_tur,siparis_veri,siparis_odeme_durum,siparis_durum,siparis_adsoyad,siparis_telefon,siparis_mail,siparis_tutar,siparis_tarih,siparis_saat,siparis_ip)VALUES('$siparis_no','$siparis_kargo','$siparis_not','$siparis_tur','$siparis_veri','$siparis_odeme_durum','$siparis_durum','$siparis_adsoyad','$siparis_telefon','$siparis_mail','$siparis_tutar','$siparis_tarih','$siparis_saat','$siparis_ip')");


	$isimle = explode(" ","$siparis_adsoyad");
	$isim_ad = $isimle[0];
	$isim_soyad = $isimle[1];
	


	## Api Ayarları
	$genel_getir=mysql_query("SELECT * FROM genelayarlar WHERE id='1'"); 
	$getir=mysql_fetch_array($genel_getir); 
	$geayar_shopier_key = $getir['geayar_shopier_key'];
	$geayar_shopier_pass = $getir['geayar_shopier_pass'];
	
	include 'core/shopier/shopierAPI.php'; 
		
	$shopier = new Shopier(''.$geayar_shopier_key.'', ''.$geayar_shopier_pass.''); 
	$shopier->setBuyer([ 
	'id' => ''.$siparis_no.'', 
	'paket' => ''.$urun_baslik.'', 
	'first_name' => ''.$isim_ad.'',
	'last_name' => ''.$isim_soyad.'',
	'email' => ''.$siparis_mail.'',
	'phone' => ''.$siparis_telefon.'']); 
	$shopier->setOrderBilling([
	'billing_address' => 'Dijital Ürün', 
	'billing_city' => 'İstanbul',
	'billing_country' => 'Türkiye',
	'billing_postcode' => '34000', 
	]);
	$shopier->setOrderShipping([
	'shipping_address' => 'Dijital Ürün', 
	'shipping_city' => 'İstanbul',
	'shipping_country' => 'Türkiye',
	'shipping_postcode' => '34000', 
	]);
	
	die($shopier->run('544546545', ''.$urun_fiyat.'', ''.$geayar_siteadresi.'/order/')); 

	}
	?>
	
	<div class="row">
	
	<div class="col-md-6">
	<h3><?php echo $dil_v_getir["m70"];?> </h3>
	<?php echo $dil_v_getir["m71"];?>
	<hr>
	
	<form action="buy-pack/<?php echo $verino;?>/?islem=buy&type=<?php echo $id;?>" method="post">
	
	<div class="row">
	
	
	<div class="form-group col-md-6">
	<label><?php echo $dil_v_getir["m72"];?></label>
    <input type="text" name="siparis_adsoyad" class="form-control" required="required">
	</div>
	
	<div class="form-group col-md-6">
	<label><?php echo $dil_v_getir["m73"];?></label>
    <input type="text" name="siparis_telefon" class="form-control" required="required">
	</div>
	
	<div class="form-group col-md-12">
	<label><?php echo $dil_v_getir["m74"];?></label>
    <input type="email" name="siparis_mail" class="form-control" required="required">
	</div>
	
	<?php if($modul_v7 == "evet"){?>
	<div class="form-group col-md-12">
	<label><?php echo $dil_v_getir["m75"];?></label>
    <input type="text" name="siparis_not" class="form-control" required="required">
	</div>
	<?php } ?>
	
	
	</div>

	
	<button type="submit" class="btn btn-primary"><?php echo $dil_v_getir["m79"]; ?></button><br><br>
	</form>
	</div>
	
	
	
	<div class="col-md-6">
	
	<?php
	$paketler_al = mysql_query("SELECT * FROM fiyattablosu WHERE id='$verino' ORDER BY paket_sira ASC limit 0,1");
	while($yaz=mysql_fetch_array($paketler_al)){
	$id = $yaz['id'];
	$baslik = $yaz['baslik'];	
	$m4 = $yaz['m4'];	
	$m5 = $yaz['m5'];	
	$m6 = $yaz['m6'];	
	$m7 = $yaz['m7'];	
	$m8 = $yaz['m8'];	
	$m9 = $yaz['m9'];	
	$m10 = $yaz['m10'];		
	$m11 = $yaz['m11'];		
	$m12 = $yaz['m12'];		
	$m13 = $yaz['m13'];		
	$m14 = $yaz['m14'];	
	$tl_formati = number_format($m5, 2, ',', '.');
	?>
	<div class="row">
	<div class="col-md-2"></div>
	<div class="col-lg-8 col-12">
	<div class="single-pricing">
	<div class="price-head">
	<?php if(empty($m7)){}else{?><div class="p-best" style="background:<?php echo $m8;?>"><p><?php echo $m7; ?></p></div><?php } ?>
	<h4 class="small-title"><?php echo $baslik;?><span><?php echo $m4;?></span></h4>
	</div>
	<h2 class="price"><span><?php echo $tl_formati;?> 	<?php echo $dil_v_getir['dil_para']; ?> </span><br><?php if($modul_v1 == "evet"){?><b class="renew" style="border:0px solid black;"><?php echo $m6;?></b><?php } ?></h2>
	<ul class="price-list">
	<?php echo $m9;?>
	</ul>
	
	
	</div>
	</div>
	<div class="col-md-2"></div>
	</div>
	<?php } ?>
	
	

	

	</div>
	
	
	</div>
	
	
	
	</div>
	
	
	</section>	
	

		
<?php
include("alt.php"); }else{echo '<meta http-equiv="refresh" content="0;URL=anasayfa/">';}
?>		