<?
echo <<<EOT
<?xml version="1.0" encoding="iso-8859-2"?>
<rss version="2.0">
  <!--FTPSite fz-->
  <channel>
    <title>Fantazyzone newsletter</title>
    <link>http://fantazyzone.pl</link>
    <description>Aktualnosci fantazyzone.pl</description>
    <language>pl</language>
    <managingEditor>fantazyzone@fantazyzone.pl</managingEditor>
    <webMaster>fantazyzone@fantazyzone.pl</webMaster>
    <copyright>Fantazyzone Team</copyright>
EOT;
$link = mysql_connect("localhost", "djdark_fz", "")
or die("Could not connect : " . mysql_error());
mysql_select_db("djdark_fantazyzone") or die("Could not select database");
include("dane/functions.inc");
$query4 = mysql_query("SELECT o.data FROM odnosniki o WHERE o.nr=1 ORDER BY o.data DESC");
$ostatni=mysql_fetch_row($query4);

//opowiadania
$query = mysql_query("SELECT o.tytul,a.autor,o.data,o.autor,o.lp FROM opowiadania o,autorzy a WHERE o.autor = a.lp ORDER BY o.data DESC LIMIT 0 , 10");

while ($result = mysql_fetch_row($query))
{
echo <<<EOT
   <item>
      <title>Opowiadanie: $result[0]</title>
      <pubDate>$result[2]</pubDate>
      <link>http://fantazyzone.pl/opowiadanie.php?opowiadanie=$result[4]</link>
      <author>publikacje@fantazyzone.pl</author>
      <category>Opowiadanie - publikacja</category>
      <description><![CDATA[Opowiadanie "$result[0]" autorstwa $result[1]a.]]></description>
    </item>
EOT;
}
$result = mysql_query("SELECT a.autor, COUNT(*) FROM autorzy a, wiersze w WHERE a.lp = w.autor GROUP BY a.autor");

//wiersze
$query = mysql_query("SELECT w.tytul, w.lp, w.data, w.autor, a.lp, a.autor FROM wiersze w, autorzy a WHERE w.autor = a.lp ORDER BY w.data  DESC  LIMIT 0, 10");

 
while ($res = mysql_fetch_row($query))

{
echo <<<EOT
<item>
      <title>Wiersz: $res[0]</title>
      <pubDate>$res[2]</pubDate>
      <link>http://fantazyzone.pl/w_poem.php?wiersz=$res[1]</link>
      <author>publikacje@fantazyzone.pl</author>
      <category>Woersz - publikacja</category>
      <description><![CDATA[Wiersz "$res[0]" autorstwa $res[5]a.]]></description>
    </item>
EOT;
}
//newsy
$query="SELECT n.tytul,n.tekst,n.pub,n.data FROM news n WHERE rodzaj='0' ORDER BY n.data  DESC  LIMIT 0, 3";
$result2=mysql_query($query);

while($result=mysql_fetch_row($result2))
{

$miech=miesiac($result[3]);
echo <<<EOT
 <item>
      <title>$result[0]</title>
      <pubDate>$result[3]</pubDate>
      <link>http://fantazyzone.pl/</link>
      <author>fantazyzone@fantazyzone.pl</author>
      <category>$result[0]</category>
      <description><![CDATA[$result[1]]]></description>
    </item>
EOT;
}	
echo <<<EOT
  </channel>
</rss>
EOT;
?>

