<?PHP
	$url = "http://www.zunuzin.com/";
	$charset="UTF-8";	
	header("Content-Type: text/xml; charset=$charset");
	echo "<"."?xml version=\"1.0\" encoding=\"$charset\"?".">";

	include("ad/consts.php");

function Logger($note) {

  $ip1 = $_SERVER["REMOTE_ADDR"];
  $ip2 = $_SERVER["HTTP_X_FORWARDED_FOR"];

  $sql  = "insert into rss_log (dt,ip1,ip2,note) values(now(),'$ip1','$ip2','$note')";
  $vopr = @mysql_query($sql,$Link_ID);
}

function myConvert($str) {
 $tmp = str_replace("<","&lt;",$str);
 $tmp = str_replace(">","&gt;",$tmp);
 $tmp = str_replace(chr(171),"&#0171;",$tmp);
 $tmp = str_replace(chr(187),"&#0187;",$tmp);
 $tmp = str_replace("&laquo;","&#0171;",$tmp);
 $tmp = str_replace("&raquo;","&#0187;",$tmp);

 return $tmp;
}

Logger("news");

	include("ad/consts2.php");

?>
<rss version="2.0">
  <channel>
    <generator>Art Gallery by Zunuzin</generator>
    <title>Art Gallery by Zunuzin news</title>
    <link>http://www.zunuzin.com</link>
    <description />
    <language>en-us</language>
    <managingEditor>zunuzin@zunuzin.com</managingEditor>
    <webMaster>webmaster@zunuzin.com</webMaster>
    <copyright>(c) Zunuzin 1998-2010</copyright>


<?PHP

	$SQL = "select * from t_news where dt_on<=now() and vis=1 order by dt_on desc limit 0, $c_rss";
	$vopr=mysql_query($SQL) or die ("No way. Can't select");

	while ($line = mysql_fetch_array($vopr))
	{
		extract($line);

		echo "
		<item>
			<title>".myConvert($title)."</title>
			<pubDate>$dt_create</pubDate>
			<description>".myConvert($msg)."</description>
		</item>";
	}

?>

  </channel>
</rss>