<?php define('access',"False"); 
require_once ("include/connect.php"); require_once ("include/tarihfonksiyonu.php"); require_once ("include/zamanfonksiyonu.php");

$tag = htmlspecialchars($_GET["etiket"], ENT_QUOTES, 'utf-8');

$TagSql = $conn->prepare("SELECT * FROM uyeetiketler WHERE seo = ?");  
$TagSql->execute(array($tag));
while ( $Etiket = $TagSql->fetch() ){
	
$EtiketBaslik = mb_convert_case($Etiket['baslik'], MB_CASE_TITLE, "UTF-8");

if(!$tag){
header("Location://".htmlspecialchars($_SERVER["HTTP_HOST"], ENT_QUOTES, 'utf-8').""); exit();
}

if($Etiket['seo'] != $tag){
header("Location://".htmlspecialchars($_SERVER["HTTP_HOST"], ENT_QUOTES, 'utf-8').""); exit();
}
$verisayisi = count($conn->query("SELECT * FROM uyeler WHERE anahtar LIKE '%".$Etiket['baslik']."%'",PDO::FETCH_ASSOC)->fetchAll());
$gosterilecek = 10;
$sayfa;
$sayfasayisi = ceil($verisayisi/$gosterilecek);
if(isset($_GET['sayfa'])){
$sayfa = htmlentities($_GET["sayfa"],  ENT_QUOTES,  "utf-8");
}else{
$sayfa = 1;
}
if($sayfa > $sayfasayisi){
$sayfa  = 1;
}elseif(!is_numeric($sayfa) || $sayfa < 1){
$sayfa = 1;
}
$baslangic = ($gosterilecek * $sayfa)-$gosterilecek;	
$NewSql = $conn->prepare("SELECT * FROM uyeler WHERE anahtar LIKE ? ORDER BY id DESC LIMIT $baslangic,$gosterilecek");  
$NewSql->execute(array("%".$Etiket['baslik']."%"));
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<base href="<?php echo $SiteBilgi["siteurl"]; ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title><?php echo $EtiketBaslik; ?> | <?php echo htmlspecialchars($_SERVER["HTTP_HOST"], ENT_QUOTES, 'utf-8'); ?></title>
<meta name="description" content="<?php echo $EtiketBaslik; ?>" />
<meta name="keywords" content="<?php echo $EtiketBaslik; ?>" />
<?php /* <link rel="amphtml" href="<?php echo $SiteBilgi["ampurl"].'escort-etiket/'.$tag; ?>" /> */ ?>
<?php echo $SiteBilgi["head"]; ?>
<link rel="icon" href="img/favicon.png">
<link rel="stylesheet" href="css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/site.php">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/anasayfa.js"></script>
</head>
<body id="top">
<?php include('include/ustmenu.php'); ?>
<div class="Header_Alani">
<h1 style="text-transform:capitalize;"><?php echo $EtiketBaslik; ?></h1>
</div>
<div class="container">
<div class="col-md-8">	
<?php while($Makale = $NewSql->fetch()){ 
$kategoriSorgula = $conn->prepare("SELECT * FROM kategori WHERE id = ?");
$kategoriSorgula->execute(array($Makale['kategori']));
$kateqoriCek = $kategoriSorgula->fetch();
?>			
<div class="panel panel-default panel-stili">
<div class="panel-body">
<div class="media">
<a class="pull-left" href="<?php echo $Makale['seo']; ?>">
<div class="cerceve"><img src="<?php if($Makale['resim'] != ''){ echo 'ModelResim/'.$Makale['resim'].''; }else{ echo 'img/resimsiz.jpg'; } ?>" alt="<?php echo $Makale['isim']; ?>" class="resim"></div>
</a>
<div class="panel-body">
<h4 class="media-heading"><a href="<?php echo $Makale['seo']; ?>"><?php echo $Makale['isim']; ?></a> </h4>
<p class="detay"><?php $metin = mb_substr($Makale['aciklama'],0,320).'... '; echo strip_tags($metin); ?></p><hr/>
<ul class="list-inline list-unstyled">
<?php $IlanTel 	= $Makale['telefon']; $WhatsappYaz 	= substr($IlanTel,0,4)." ".substr($IlanTel,4,3)." ".substr($IlanTel,7,2)." ".substr($IlanTel,9,2); ?>
<a href="<?php echo $Makale['seo']; ?>" class="btn btn-xs btn-success"> Profili Görüntüle</a>            
<a href="tel://<?php echo $Makale['telefon']; ?>" class="btn btn-xs btn-danger"><?php echo $WhatsappYaz; ?></a>
<a href="kategori/<?php echo $kateqoriCek['seo']; ?>" class="btn btn-xs btn-default"><?php echo $kateqoriCek['baslik']; ?></a>
</ul>
</div>
</div>
</div>
</div>
<?php } ?>
<nav aria-label="Page navigation">
<ul class="pagination pagination-sm">
<?php 
if($sayfa > 1){
echo '<li><a href="escort-etiket/'.$tag.'&sayfa=1">İlk</a></li>';
echo '<li><a title="önceki" href="escort-etiket/'.$tag.'&sayfa='.($sayfa-1).'">&laquo;</a></li>';
}
$ekgoster = 2;
for($i = $sayfa - $ekgoster; $i <= $sayfa + $ekgoster;$i++){
if($i > 0 && $i <= $sayfasayisi){
if($i == $sayfa){
echo '<li><a class="active">'.$i.'</a></li>';
}else{
echo '<li><a href="escort-etiket/'.$tag.'&sayfa='.$i.'">'.$i.'</a></li>';
}
}
}
if($sayfa < $sayfasayisi){
echo '<li><a title="sonraki" href="escort-etiket/'.$tag.'&sayfa='.($sayfa+1).'">&raquo;</a></li>';
echo '<li><a href="escort-etiket'.$tag.'&sayfa='.$sayfasayisi.'">Son</a></li>';
}
?>	
</ul>
</nav>
</div>
<div class="col-md-4">
<?php include('include/sidebar.php'); ?>		
</div>
<div class="temizle"></div>
<?php include('include/alt.php'); ?>
</div><!--/.container-->
<script src="js/bootstrap.js"></script>
</body>
</html>