<?php
include("ust.php");
	$d_g_urun_b = $dil_v_getir['m29'];
	$d_g_urun_k = $dil_v_getir['m30'];
	## ÜRÜNLER MODÜLÜ 
	$m_kontrol=mysql_query("SELECT * FROM moduller WHERE modul_adi='urunler'"); 
	$getir=mysql_fetch_array($m_kontrol); 
	$urun_m_durum = $getir['modul_durum'];
	$urun_m_s_limit = $getir['modul_v1'];
	$urun_m_o_sayi = $getir['modul_v2'];
	$urun_m_s_miktar = $getir['modul_v3'];
	$urun_m_fiyat = $getir['modul_v4'];
	$blog_etiket_mo = $getir['modul_v5'];
	if($urun_m_durum == "acik"){
	$verino = g("verino");	
?>
	
	<br>
	<div class="container">
	
	<?php if(empty($verino)){?><h3><?php echo $d_g_urun_b; ?></h3><?php }else{
	$kategori_bul=mysql_query("SELECT * FROM urun_kategori WHERE seo_url='$verino'"); 
	$getir=mysql_fetch_array($kategori_bul); 
	$kat_baslik = $getir['baslik'];
	echo '<h3>'.$kat_baslik.'</h3>';
	}
	?>
	

	<hr>
	</div>
	
	<section class="blog-layout news-default">
	<div class="container">
	<div class="row">
	<div class="col-lg-9 col-12">
	<div class="row">
	<?php if(empty($verino)){ ?>
	<?php
	$sayfada = $urun_m_s_limit; 
	$sorgu = mysql_query('SELECT COUNT(*) AS toplam FROM urunler WHERE veri_dil="'.$dil_durum.'"');
	$sonuc = mysql_fetch_assoc($sorgu);
	$toplam_icerik = $sonuc['toplam'];
	$toplam_sayfa = ceil($toplam_icerik / $sayfada);
	$sayfano = g("sayfa");
	$sayfa = isset($sayfano) ? (int) $sayfano : 1;
	if($sayfa < 1) $sayfa = 1; 
	if($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa; 
	$limit = ($sayfa - 1) * $sayfada;
	$sorgu = mysql_query('SELECT * FROM urunler WHERE veri_dil="'.$dil_durum.'" ORDER BY id DESC LIMIT ' . $limit . ', ' . $sayfada);
 
	while($icerik = mysql_fetch_assoc($sorgu)) {
	$urun_baslik= $icerik['baslik'];
	$urun_url = $icerik['seo_url'];
	$urun_resim = $icerik['resim'];
	$urun_fiyat = $icerik['m4'];
	$tl_formati = number_format($urun_fiyat, 2, ',', '.');	
	if($urun_m_fiyat == "evet"){ $t_o_k = "<br><font color='#ff9600'>$tl_formati ".$dil_v_getir["dil_para"]."</font>";}else{}
	echo '
	<div class="col-lg-'.$urun_m_s_miktar.' col-md-'.$urun_m_s_miktar.' col-12">
	<div class="single-news ">
	<a href="urun/'.$urun_url.'">
	<div class="news-head overlay">
	<img src="'.$urun_resim.'" alt="'.$urun_baslik.'">
	</div>
	</a>
	<div class="news-body">
	<div class="news-content">
	<h6  style="font-size:16px;"><a href="urun/'.$urun_url.'">'.$urun_baslik.' '.$t_o_k.'</a></h6>
	</div>
	</div>
	</div>
	</div>
	';
	}
	?>
	<?php }else{ ?>
	
	<?php
	

	$kategori_bul=mysql_query("SELECT * FROM urun_kategori WHERE seo_url='$verino'"); 
	$getir=mysql_fetch_array($kategori_bul); 
	$kat_id = $getir['id'];
	$goruntuleme = $getir['goruntuleme'];

	$sayi1= $goruntuleme;
	$sayi2=1;
	$toplam=$sayi1+$sayi2;
	$g_arttir = mysql_query("update urun_kategori set goruntuleme='$toplam' where id='$kat_id'") or die("Hata Olustu!");

	
	$sayfada = $urun_m_s_limit; 
	$sorgu = mysql_query('SELECT COUNT(*) AS toplam FROM urunler WHERE veri_dil="'.$dil_durum.'" AND m15='.$kat_id.'');
	$sonuc = mysql_fetch_assoc($sorgu);
	$toplam_icerik = $sonuc['toplam'];
	$toplam_sayfa = ceil($toplam_icerik / $sayfada);
	$sayfano = g("sayfa");
	$sayfa = isset($sayfano) ? (int) $sayfano : 1;
	if($sayfa < 1) $sayfa = 1; 
	if($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa; 
	$limit = ($sayfa - 1) * $sayfada;
	$sorgu = mysql_query('SELECT * FROM urunler WHERE veri_dil="'.$dil_durum.'" AND m15='.$kat_id.' ORDER BY id DESC LIMIT ' . $limit . ', ' . $sayfada);
 
	while($icerik = mysql_fetch_assoc($sorgu)) {
	$urun_baslik= $icerik['baslik'];
	$urun_url = $icerik['seo_url'];
	$urun_resim = $icerik['resim'];
	$urun_fiyat = $icerik['m4'];
	$tl_formati = number_format($urun_fiyat, 2, ',', '.');	
	if($urun_m_fiyat == "evet"){ $t_o_k = "<br><font color='#ff9600'>$tl_formati ".$dil_v_getir["dil_para"]."</font>";}else{}
	echo '
	<div class="col-lg-'.$urun_m_s_miktar.' col-md-'.$urun_m_s_miktar.' col-12">
	<div class="single-news ">
	<a href="urun/'.$urun_url.'">
	<div class="news-head overlay">
	<img src="'.$urun_resim.'" alt="'.$urun_baslik.'">
	</div>
	</a>
	<div class="news-body">
	<div class="news-content">
	<h6  style="font-size:16px;"><a href="urun/'.$urun_url.'">'.$urun_baslik.''.$t_o_k.'</a></h6>
	</div>
	</div>
	</div>
	</div>
	';
	}
	?>
	<?php } ?>
	
	</div>
	
	<div class="row">
	<div class="col-12">
	<div class="pagination-plugin">
	<ul class="pagination-list">
	<?php $verino = g("verino"); if(empty($verino)){ ?>
	<?php
	for($s = 1; $s <= $toplam_sayfa; $s++) {
	if($sayfa == $s) { 
	echo '<li class="page-numbers current"><a href="urunler/?sayfa='.$s.'">'.$s.'</a></li>'; 
	}else{
	echo '<li class="page-numbers "><a href="urunler/?sayfa='.$s.'">'.$s.'</a></li>';
    }}
	?>
	<?php }else{ ?>
	<?php
	for($s = 1; $s <= $toplam_sayfa; $s++) {
	if($sayfa == $s) { 
	echo '<li class="page-numbers current"><a href="urunler/'.$verino.'?sayfa='.$s.'">'.$s.'</a></li>'; 
	}else{
	echo '<li class="page-numbers "><a href="urunler/'.$verino.'?sayfa='.$s.'">'.$s.'</a></li>';
    }}
	?>
	<?php } ?>
	</ul>
	</div>
	</div>
	</div>
				
	</div>
	
	<div class="col-lg-3 col-12">
	<br>
	<div class="service-sidebar">	
	<div class="service-single-sidebar widget">
	<h2 class="widget-title"><?php echo $d_g_urun_k;?></h2>		
	<div class="menu-service-menu-container">
	<ul id="menu-service-menu" class="menu">
	<?php
	$sayfa_al = mysql_query("SELECT * FROM urun_kategori WHERE veri_dil='$dil_durum' ORDER BY id DESC limit 0,999");
	while($yaz=mysql_fetch_array($sayfa_al)){
	$id = $yaz['id'];
	$kategori_baslik= $yaz['baslik'];
	$kategori_url = $yaz['seo_url'];
	
	$query3 = mysql_query("SELECT * FROM `urunler` WHERE m15='$id'");
	$p_b_k_sayi = mysql_num_rows($query3);
	
	echo '	<li><a href="urunler/'.$kategori_url.'">'.$kategori_baslik.' <font style="float:right;">('.$p_b_k_sayi.')</font></a></li>';
	}
	?>
	</ul>
	</div>
	</div>
	</div>
	
	<div class="blog-sidebar">
	<div class="single-sidebar bizwheel_latest_news_widget">
	<h2 class="sidebar-title"><?php echo $dil_v_getir['m32']; ?></h2>
	
	<?php
	$blog_al = mysql_query("SELECT * FROM urunler WHERE veri_dil='$dil_durum' ORDER BY goruntuleme DESC limit 0,5");
	while($yaz=mysql_fetch_array($blog_al)){
	$id = $yaz['id'];
	$urun_baslik_o = $yaz['baslik'];
	$urun_url_o = $yaz['seo_url'];
	$urun_resim_o = $yaz['resim'];
	$urun_kategori_o = $yaz['m15'];
	

	$m_kontrol=mysql_query("SELECT * FROM urun_kategori WHERE id='$urun_kategori_o'"); 
	$getir=mysql_fetch_array($m_kontrol); 
	$o_urun_baslik = $getir['baslik'];

	echo '
	<div class="row" style="margin-top:5px;">
	<div class="col-md-5"><a href="urun/'.$urun_url_o.'"><img src="'.$urun_resim_o.'" alt="'.$urun_baslik_o.'"></a></div>
	<div class="col-md-7">
	<a href="urun/'.$urun_url_o.'"><h6>'.$urun_baslik_o.'</h6>'.$o_urun_baslik.'</a>
	</div>
	</div>
	<hr>
	';
	}
	?>			
	</div>
	
	<?php if($blog_etiket_mo == "evet"){?>
	<div class="single-sidebar tagcloud">
	<h2 class="sidebar-title"><?php echo $dil_v_getir['m21']; ?></h2>
	<ul>
	<?php
	$blog_al = mysql_query("SELECT * FROM urunler WHERE veri_dil='$dil_durum' ORDER BY RAND() DESC limit 0,3");
	while($yaz=mysql_fetch_array($blog_al)){
	$id = $yaz['id'];
	$a_k_cek = $yaz['seo_anahtarkelime'];
	$a_u_cek = $yaz['seo_url'];
	
	$dizi = explode (",",$a_k_cek);
	$i=0;
	foreach ($dizi as $d) {
	if($i==50){
	echo '<br>';
	$i=0;
     }
	$i++;
	echo '<li><a href="urun/'.$a_u_cek.'">'.$d.'</a></li>';
	}
	}
	?>
	</ul>
	</div>
	<?php } ?>
	
	</div>
	
	</div>
					
					
	</div>
		
	</div>
	</section>
		

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