Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.11 KB | None | 0 0
  1. function kategori(){
  2.  
  3.     if ($link = $_GET["url"]){
  4.         // Kategoriyi bulalım
  5.         $katbul = mysql_query("select * from kategoriler where kategori_sef_link='$link'");
  6.         $katsay = mysql_num_rows($katbul);
  7.         if ($katsay > 0){
  8.             $katgoster = mysql_fetch_array($katbul);
  9.             $katID = $katgoster["id"];
  10.             $sayfa = $_GET["sayfa"];
  11.             if ($sayfa=="" || !is_numeric($sayfa)){
  12.                 $sayfa = 1;
  13.                 $kacar = $GLOBALS["sayfa_limiti"];
  14.                 $ksayisi = mysql_num_rows(mysql_query("select id,kategori_id from konular where kategori_id ='$katID'"));
  15.                 $ssayisi = ceil($ksayisi/$kacar);
  16.                 $nereden = ($sayfa*$kacar)-$kacar ;
  17.                 if ($sayfa > $ssayisi){
  18.             bilgi("Hata!","Böyle bir sayfa bulunamadı.");
  19.         }else{
  20.                
  21.                 $konubul = mysql_query("select * from konular where kategori_id ='$katID' order by id desc LIMIT $nereden,$kacar");
  22.                 while($konugoster = mysql_fetch_array($konubul)){
  23.                     extract($konugoster);
  24.                     $konu_basligi = stripslashes($konu_basligi);
  25.                     $konu_anasayfa = stripslashes($konu_anasayfa);
  26.                     $yazar2 =   mysql_fetch_array(mysql_query("select id,kadi from uyeler where id='$ekleyen'"));
  27.                         $yazar = $yazar2["kadi"];
  28.                        
  29.                     // Konu Kategorisi Bul
  30.                         $kategori = $katgoster["kategori_adi"];
  31.                     // Konuya ait yorumları bul
  32.                         $yorumbul = mysql_query("select id,konuID from yorumlar where konuID='$id' && onay='1'");
  33.                         $yorumsayisi = mysql_num_rows($yorumbul);
  34.                        
  35.                         $link = $GLOBALS["site_adresi"].$konu_basligi_sef.".html";
  36.                         //$link = "index.php?git=konu&link=".$konu_basligi_sef;
  37.                     require ($GLOBALS["tema_adresi"]."/konu_anasayfa.php");
  38.                
  39.                         } if ($ksayisi > $kacar){
  40.                     echo "<div class='sayfala'>";
  41.                     for($i = 1; $i <= $ssayisi; $i++){
  42.                     echo '<a href="/kategori/'.$katgoster["kategori_sef_link"].'/'.$i.'"';
  43.                                 if ($sayfa == $i){
  44.                                     echo "class='aktif'";
  45.                     }
  46.                     echo '>'.$i.'</a>';
  47.                     }
  48.                     echo "</div>";
  49.                     }
  50.            
  51.                 }  
  52.             }
  53.         }else{
  54.             bilgi("Lütfen Dikkat!..","Böyle bir kategori mevcut değil ya da silinmiş olabilir.");
  55.             header("Refresh:2; url=index.php");
  56.         }
  57.     }else{
  58.         header("Location:index.php");
  59.     }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement