<?php
session_start();
include("config.php");
include("plugin/functions.php");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
$query = mysql_query("select * from settings");
while($print = mysql_fetch_array($query)){
$url = $_GET['url'];
$gelen = mysql_query("select * from galleries where sefurl='$url'"); if(mysql_num_rows($gelen)=="0"){ header("Location:404.php"); exit(); }else{
while($yazdir = mysql_fetch_array($gelen)){ $id = $yazdir['id']; 

			$yorum_za=strtotime($yazdir['tarih']);
			$ay=array('','Ocak','Şubat','Mart','Nisan','Mayıs','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'); 
			$yorum_z=date('d',$yorum_za)." ".$ay[date("n",$yorum_za)]." ".date('Y', $yorum_za); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="description" content="<?php echo $print['description']; ?>" />
	<meta name="keywords" content="<?php echo $print['keywords']; ?>" />	
	<meta name="author" content="radyo sitesi, radyo dinle" />	
	<link rel="shortcut icon" href="/images/favicon.png">
	<title><?php echo $yazdir['baslik']; ?> | <?php echo $print['title']; ?></title>	
	
	<link rel="stylesheet" media="screen" href="css/superfish.css" type="text/css" />
	<link rel="stylesheet" media="screen" href="css/stylesheet.css" type="text/css" />
	<link rel="stylesheet" media="screen" href="css/color.css" type="text/css" />		
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic" type="text/css" />
	
	<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
	<script src="js/hoverIntent.js" type="text/javascript"></script>
	<script src="js/superfish.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="js/custom.js"></script>	
</head>
<body>
<?php include("plugin/writelogin.php"); ?> 
<?php include("header.php"); ?> 
  
  <div id="content-wrapper">
    <h3 id="full_width_title"><?php echo $yazdir['baslik']; ?></h3>
		<div class="post-meta"><span class="posting-date"><?php echo $yorum_z; ?></span> </div>	<br><br>
		
    <div class="entry-content" align="center">
<?php 

$limit = 1;

$page = @$_GET["page"];

if(empty($page) or !is_numeric($page)) {

$page = 1;

}
	$count			 = mysql_num_rows(mysql_query("SELECT id FROM resimler where gID='$id' order by id desc"));
	$toplamsayfa	 = ceil($count / $limit);
	$baslangic		 = ($page-1)*$limit;

if($toplamsayfa < @$_GET["page"]){ echo '<meta http-equiv="refresh" content="0;URL=404.php">'; exit(); }else{ }	
	
$sorustur = "SELECT * FROM resimler where gID='$id' ORDER BY id desc LIMIT $baslangic,$limit";

$yazdir_sorgu = mysql_query($sorustur) or die(mysql_error()); if(mysql_num_rows($yazdir_sorgu)=="0"){

echo '<font color="blue"><b>Eklenmiş bir resim bulunamadı! Lütfen daha sonra tekrar deneyin.</b></font>'; }else{

while ($write = mysql_fetch_array($yazdir_sorgu)){ ?>		


	<img src="<?php echo $write['resimyolu']; ?>" alt="" /><br><br><?php echo $write['text']; ?><br><br>
	<b>Şuan <?php if(isset($_GET['page'])){ echo @$_GET['page']; echo '.'; }else{  echo '1.'; } ?> resimdesiniz. Toplam <?php echo $toplamsayfa; ?> resim bulunmaktadır.</b>
	<br><br>
            <div class="social_sharing_post"> 
	<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/tr_TR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" style="padding-right:40px;" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div>

<a href="https://twitter.com/share" class="twitter-share-button" data-lang="tr">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>		

<div class="g-plusone" data-size="medium"></div>
<script type="text/javascript">
  window.___gcfg = {lang: 'tr'};

  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>			
			</div>	

	  <?php
	  } }
	  echo '<div class="pagenavi clearfix" style="text-align:center;">';
if($count > $limit) : 
  $x = 2; 
  $lastP = ceil($count/$limit); 

 if($print['seourl']==".php"){
  if($page > 1){
  $onceki = $page-1;
  echo "<a class=\"prevpostslink\" style='color:white;' href=\"?url=$url&page=$onceki\"> << </a>"; 
  } }elseif($print['seourl']==".html"){
  if($page > 1){
  $onceki = $page-1;
  echo "<a class=\"prevpostslink\" style='color:white;' href=\"galeri-$url&page=$onceki.html\"> << </a>"; } }
 
 if($print['seourl']==".php"){
  if($page==1) echo "<span class=\"current\">1</span>"; 
  else echo "<a class=\"page_number\" href=\"?url=$url&page=1\">1</a>&nbsp;";   
  }elseif($print['seourl']==".html"){
   if($page==1) echo "<span class=\"current\">1</span>"; 
  else echo "<a class=\"page_number\" href=\"galeri-$url&page=1.html\">1</a>&nbsp;";  } 
  
  if($page-$x > 2) { 
    echo "..."; 
    $i = $page-$x; 
  } else { 
    $i = 2; 
  } 

 if($print['seourl']==".php"){  
  for($i; $i<=$page+$x; $i++) { 
    if($i==$page) echo "<span class=\"current\">$i</span>"; 
    else echo "<a class=\"page_number\" href=\"?url=$url&page=$i\">$i</a>&nbsp;"; 
    if($i==$lastP) break; 
  } }elseif($print['seourl']==".html"){
  for($i; $i<=$page+$x; $i++) { 
    if($i==$page) echo "<span class=\"current\">$i</span>"; 
    else echo "<a class=\"page_number\" href=\"galeri-$url&page=$i.html\">$i</a>&nbsp;"; 
    if($i==$lastP) break; 
  } }  

  if($page+$x < $lastP-1) { 
    echo "<span class=\"extend\">...</span>"; 
    echo "<a class=\"page_number\" href=\"?url=$url&page=$lastP\">$lastP</a>"; 
  } elseif($page+$x == $lastP-1) { 
    echo "<a class=\"page_number\" href=\"?url=$url&page=$lastP\">$lastP</a>"; 
  } 

if($print['seourl']==".php"){  
  if($page < $lastP){
  $sonraki = $page+1;
  echo "<a class=\"nextpostslink\" href=\"?url=$url&page=$sonraki\"> >> </a>"; 
  } }elseif($print['seourl']==".html"){
  if($page < $lastP){
  $sonraki = $page+1;
  echo "<a class=\"nextpostslink\" href=\"galeri-$url&page=$sonraki.html\"> >> </a>"; 
  } }  
endif; echo '</div>';  ?>		

    </div>
    <div class="clear"></div>
  </div>
  
  <div id="footer"> <span id="Scroll"><a href="#">&uarr;</a></span>
    <div id="footer_inner">
<?php echo $print['reklam3']; ?>
      <div class="clear"></div>
      <div class="footer_bottom">
        <ul class="footer_menu">
          <li><a href="index<?php echo $print['seourl']; ?>">Anasayfa</a> /</li>		
<?php $whistle = mysql_query("select * from pages order by sira asc"); while($baby = mysql_fetch_array($whistle)){ if($print['seourl']==".php"){ ?>		
          <li><a href="pages.php?url=<?php echo $baby['sefurl']; ?>"><?php echo $baby['baslik']; ?></a> /</li>
	<?php }elseif($print['seourl']==".html"){ ?>	  
          <li><a href="sayfa-<?php echo $baby['sefurl']; ?>.html"><?php echo $baby['baslik']; ?></a> /</li>
	<?php } } ?>	
          <li><a href="iletisim<?php echo $print['seourl']; ?>">İletişim</a></li>
        </ul>
        <p>&copy; Copyright <?php echo date('Y'); ?>, <?php echo $print['title']; ?>. Tüm hakları saklıdır.</p>
      </div>
    </div>
  </div>
</div>
</body>
</html>
<?php } } } ?>