<?php
include_once("inc/config.php");
header("Content-type: application/xml");
print '<?xml version="1.0" encoding="gb2312"?>';
print '<?xml-stylesheet type="text/xsl" href="rss.xsl" version="1.0" encoding="gb2312"?>';
print '<rss version="2.0">';

include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("conn.php");
$layer_1 = ftbbs_request($_GET["layer_1"]);
$layer_2 = ftbbs_request($_GET["layer_2"]);

$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,86400);

$url=$ftbbsmb[10];
if (substr($url,-1)!="/"){
   $url=$url."/";
}
?>
<channel>
<link><?=$ftbbsmb[10]?></link>
<description><?=$ftbbsmb[11]?></description>
<?
$str="";
if ($layer_1!=""){
   $str=" where {$tablepre}bbs_cate.BBS_Cate_ID = {$tablepre}bbstitle.BoardID_2 and {$tablepre}bbstitle.BoardID_1='".$layer_1."' and {$tablepre}bbstitle.deleted=0 and {$tablepre}bbs_cate.BBS_Cate_Qs=0 order by {$tablepre}bbstitle.ID desc";
}
else{
   $str=" where {$tablepre}bbs_cate.BBS_Cate_ID = {$tablepre}bbstitle.BoardID_2 and {$tablepre}bbstitle.deleted=0 and {$tablepre}bbs_cate.BBS_Cate_Qs=0 order by {$tablepre}bbstitle.ID desc";
}
$SQL = "Select * from {$tablepre}bbs_cate,{$tablepre}bbstitle".$str." limit 0,10";
$rs=mysql_query($SQL);
$myrow = mysql_fetch_array($rs);
$numrows=$myrow[0];//记录总数

if ($numrows==0){
  echo "<item></item>";
}
else{
    do {
    echo "<item>" ;
	echo "<title><![CDATA[".$myrow["title"]."]]></title>" ;
	echo "<link>".$url."ftbbs.php?id=".$myrow["ID"]."</link>" ;
	echo "<author>".$myrow["name"]."</author>" ;
	echo "<pubDate>".$myrow["dateh"]."</pubDate>" ;
 	echo "<description><![CDATA[".$myrow["menu"]."]]></description>" ;
	echo "</item>";
    } 
    while ($myrow = mysql_fetch_array($rs));                
    $db->close(); 
}
?>
</channel>
</rss>