<?php 
function baglan() {
    @mysql_connect("localhost", "", "") or die ("Hata: Bilgiler yanlis oldugu icin veritabanina baglanilamadi!");
    @mysql_select_db("") or die ("Hata: Veritabani bulunamiyor!");
    @mysql_query("SET NAMES 'utf8'");
}
function durdur() {
	@mysql_close();
}

function temizlex($ork) {
$ork = str_replace("%3A",":",$ork);
$ork = str_replace("%2F","/",$ork);
$ork = str_replace("%3F","?",$ork);
$ork = str_replace("%3D","=",$ork);
$ork = str_replace("%26","&",$ork);
$ork=trim($ork);
return $ork;
}


function guvenlik($qvedat) {
$qvedat = str_replace("`","",$qvedat);
$qvedat = str_replace("=","",$qvedat);
$qvedat = str_replace("&","",$qvedat);
$qvedat = str_replace("%","",$qvedat);
$qvedat = str_replace("!","",$qvedat);
$qvedat = str_replace("#","",$qvedat);
$qvedat = str_replace("<","",$qvedat);
$qvedat = str_replace(">","",$qvedat);
$qvedat = str_replace("*","",$qvedat);
$qvedat = str_replace("/","",$qvedat);
$qvedat = str_replace("\"","",$qvedat);
$qvedat = str_replace("$","",$qvedat);
$qvedat = str_replace("?","",$qvedat);
$qvedat = str_replace("'","",$qvedat);
$qvedat = str_replace("-","",$qvedat);
$qvedat = str_replace(")","",$qvedat);
$qvedat = str_replace("(","",$qvedat);
$qvedat = str_replace(" or ","",$qvedat);
$qvedat=trim($qvedat);
return $qvedat;
}

function kisalt($metin,$sayi) {
$limit = $sayi;
$uzunluk = strlen($metin);
if ($uzunluk > $limit) {
$metin = substr($metin,0,$limit);
} return $metin; }

function seo($s) {
$tr =array("ş","Ş","ı","ü","Ü","ö","Ö","ç","Ç","ş","Ş","ı","ğ","Ğ","İ","ö","Ö","Ç","ç","ü","Ü");
$eng =array("s","S","i","u","U","o","O","c","C","s","S","i","g","G","I","o","O","C","c","u","U");
$s = str_replace($tr,$eng,$s);
$s = strtolower($s);
$s = preg_replace('/&.+?;/', '', $s);
$s = preg_replace('/[^%a-z0-9 _-]/', '', $s);
$s = preg_replace('/\s+/', '-', $s);
$s = preg_replace('|-+|', '-', $s);
$s = trim($s, '-');
 
return $s;
}


function katseo($s) {
$tr =array("ş","Ş","ı","ü","Ü","ö","Ö","ç","Ç","ş","Ş","ı","ğ","Ğ","İ","ö","Ö","Ç","ç","ü","Ü"," ");
$eng =array("s","S","i","u","U","o","O","c","C","s","S","i","g","G","I","o","O","C","c","u","U","");
$s = str_replace($tr,$eng,$s);
$s = strtolower($s);
$s = preg_replace('/&.+?;/', '', $s);
$s = preg_replace('/[^%a-z0-9 _-]/', '', $s);
$s = preg_replace('/\s+/', '-', $s);
$s = preg_replace('|-+|', '-', $s);
$s = trim($s, '-');
 
return $s;
}

function tagsrenk($uzunluk) {
    $karakterler = "0123456789".
                   "acf";
    $sonuc = "";
    while(strlen($sonuc) < $uzunluk) {
      $sonuc .= substr($karakterler, (rand() % strlen($karakterler)), 1);
    }
    return($sonuc);
  }

function etiket($etiket) 
{
$tr=array('Þ','þ','Ü','ü','Ö','ö','Ç','ç','Ð','ð','ý','-',')','(','!',' ');
$cv=array('S','s','U','u','O','o','C','c','G','g','I','','','','','','');
$cvtr = str_replace($tr,$cv,$etiket);
$s = strtolower($etiket);
$s = preg_replace('/&.+?;/','', $etiket);
$s = preg_replace('/[^%a-z0-9 _-]/','', $etiket);
$s = preg_replace('/\s+/', '-', $etiket);
$s = preg_replace('|-+|', '-', $etiket);
$s = trim($s, '-');
return $cvtr;
}



function etiketsistemi($icerik){
$tr=array('Þ','þ','Ü','ü','Ö','ö','Ç','ç','Ð','ð','ý','-',')','(','!');
$cv=array('S','s','U','u','O','o','C','c','G','g','I','');
$cvtr = str_replace($tr,$cv,$icerik);
$s = strtolower($etiket);
$s = preg_replace('/&.+?;/','', $etiket);
$s = preg_replace('/[^%a-z0-9 _-]/','', $etiket);
$s = preg_replace('/\s+/', '-', $etiket);
$s = preg_replace('|-+|', '-', $etiket);
$s = trim($s, '-');

foreach (str_word_count($icerik,1,'ıİüÜöÖğĞşŞçÇ1234567890') as $etiket ){

    $etiket=mb_strtolower($etiket,"utf8"); //harflerimizi küçültelim

    echo '<a href="etiket/'.$etiket.'" title="'.$etiket.'">'.$etiket.'</a> ';

}

}


function temizle($string) 
{ if(get_magic_quotes_gpc()) 
{ $string = stripslashes($string); } 
elseif(!get_magic_quotes_gpc()) 
{ $string = addslashes($string); 
} $string = @mysql_real_escape_string($string); 
return $string; } 

function post($veri){
    if (!get_magic_quotes_gpc()) { 
        $veri = addslashes($veri); 
        } 
    return $veri;
} 


$populer = "Populer Videolar";
$yeniler = "Yeni Eklenen Videolar";



baglan();
$baglan  = "Select * from reklam where id=1";
$goster = @mysql_fetch_array(mysql_query($baglan));
$sagreklam = $goster['reklam_kod'];
$rekbas1 = $goster['rek_bas'];
$rekbit1 = $goster['rek_bit'];


baglan();
$baglan  = "Select * from reklam where id=2";
$goster = @mysql_fetch_array(mysql_query($baglan));
$videonu = $goster['reklam_kod'];
$rekbas2 = $goster['rek_bas'];
$rekbit2 = $goster['rek_bit'];


baglan();
$baglan  = "Select * from reklam where id=3";
$goster = @mysql_fetch_array(mysql_query($baglan));
$altreklam = $goster['reklam_kod'];
$rekbas3 = $goster['rek_bas'];
$rekbit3 = $goster['rek_bit'];



baglan();
$baglan  = "Select * from ayarlar where id=1";
$goster = @mysql_fetch_array(mysql_query($baglan));
$siteadi = $goster['site_adi'];
$siteadresi = $goster['site_adresi'];
$aciklama = $goster['site_aciklama'];
$email = $goster['email'];
$keywords = $goster['anahtar_kelimeler'];
$facebook = $goster['facebook'];
$twitter = $goster['twitter'];
$footer = $goster['footer'];



baglan();
$baglan  = "Select * from linkler";
$goster = @mysql_fetch_array(mysql_query($baglan));
$link = $goster['link'];
$link2 = $goster['link2'];
$link3 = $goster['link3'];
$link4 = $goster['link4'];
$link5 = $goster['link5'];
$baslik = $goster['baslik'];
$baslik2 = $goster['baslik2'];
$baslik3 = $goster['baslik3'];
$baslik4 = $goster['baslik4'];
$baslik5 = $goster['baslik5'];



?>