<?php
function html_clean($string) { 

$special_chars_replace = array( 
"&amp;","&lt;","&gt;", "&quot;" 
); 
$special_chars_search = array( 
"&","<",">", "\"" 
); 

$string = str_replace($special_chars_search, $special_chars_replace, $string); 
return $string;         
}  

include ("../config.php"); include ("functions.php");
header("Content-type: text/xml\n\n");

$url = $_GET['url'];

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)){ 

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rss version=\"2.0\">
<channel>
<title>$print[title]</title>
<link>$_SERVER[HTTP_HOST]</link>
<description>RSS Beslemesi</description>
<copyright>© 2013, Php Scriptlerim - www.phpscriptlerim.com</copyright>
<language>tr</language>";

$aaa = mysql_query("select * from news where kategori='$url' AND onay='1' order by id desc limit 0,10"); while($bbb = mysql_fetch_array($aaa)){ $zkkm = kisalt($bbb['icerik'], 400); $asd = html_clean($zkkm); 

$aa1 = mysql_query("select * from newskat where sefurl='$url'"); while($bb1 = mysql_fetch_array($aa1)){ 

	$yorum_za=strtotime($bbb['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);

if($print['seourl']==".php"){ 	
echo "
<item>
<title>$bbb[baslik]</title>
<link>http://$_SERVER[HTTP_HOST]/single.php?url=$bbb[sefurl]</link>
<pubDate>$yorum_z</pubDate>
<description>$asd</description>
<category>$bb1[baslik]</category>
</item>
";
}elseif($print['seourl']==".html"){ 
echo "
<item>
<title>$bbb[baslik]</title>
<link>http://$_SERVER[HTTP_HOST]/haber-$bbb[sefurl].html</link>
<pubDate>$yorum_z</pubDate>
<description>$asd</description>
<category>$bb1[baslik]</category>
</item>
";
	} } } }
echo "
</channel>
</rss>"; 
?>