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

include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("conn.php");
include_once("inc/ftcode.php");
$id = intval($_GET["id"]);

$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>
<?
$SQL = "Select * from {$tablepre}bbstitle where ID=".$id." limit 0,1";
$rs=mysql_query($SQL);
$myrow = mysql_fetch_array($rs);
$numrows=$myrow[0];//记录总数
if ($numrows==0){
  echo "<item></item>";
}
else{
    $title=$myrow["title"];
    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[".nohtml($myrow["menu"])."]]></description>" ;
	echo "</item>";
}
mysql_free_result($rs);
$sql = "Select * from {$tablepre}bbsmenu where pid=".$id." limit 0,30";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
$numrows=$myrow[0];//记录总数
if ($numrows!=0){
    do {
    echo "<item>" ;
	echo "<title><![CDATA[".$title."]]></title>" ;
	echo "<link>".$url."ftbbs.php?id=".$myrow["pid"]."</link>" ;
	echo "<author>".$myrow["user_id"]."</author>" ;
	echo "<pubDate>".$myrow["dateh"]."</pubDate>" ;
 	echo "<description><![CDATA[".nohtml($myrow["remenu"])."]]></description>" ;
	echo "</item>";
    } 
    while ($myrow = mysql_fetch_array($rs));                
    $db->close(); 
}
?>
</channel>
</rss>