header("Content-type: text/xml");
include('../include/auth.php');
function xmlentities ( $string )
{
return str_replace ( array ( '&', '"', "'", '<', '>' ), array ( '&' , '"', ''' , '<' , '>' ), $string );
}
$nl = "\n";
$t = "\t";
if(!$howmany||$howmany<0||$howmany>100)
$howmany=10;
unset($output);
// opening DB
$dbl = mysql_connect($db['host'], $db['user'], $db['password']);
if(!$dbl) {
die('SQL error... sorry ! ^^; I\'m on it !');
}
mysql_select_db($db['database'],$dbl);
$output = ''.$nl;
$output.= ''.$nl;
$output.= $t.''.$nl;
$output.= $t.$t.'pouet.net'.$nl;
$output.= $t.$t.'http://www.pouet.net/'.$nl;
$output.= $t.$t.'your online demoscene resource'.$nl;
$output.= $t.$t.'en-us'.$nl;
$output.= $t.$t.'Copyright 2000-'.date('Y').' Mandarine'.$nl;
$output.= $t.$t.'webmaster@pouet.net'.$nl;
$output.= $t.$t.'webmaster@pouet.net'.$nl;
// lastBuildDate
$query = 'SELECT lastpost FROM bbs_topics ORDER BY lastpost DESC LIMIT 1';
$result = mysql_query($query);
$lastBuildDate = date('D, d M Y H:i:s',strtotime(mysql_result($result, 0)));
$output.= $t.$t.''.$lastBuildDate.' CST'.$nl;
$output.= $t.$t.'pouet.net'.$nl;
$output.= $t.$t.'http://backend.userland.com/rss'.$nl;
$output.= $t.$t.'60'.$nl;
// logo
$output.= $t.$t.''.$nl;
$output.= $t.$t.$t.'http://www.pouet.net/gfx/buttons/pouet.gif'.$nl;
$output.= $t.$t.$t.'pouet.net'.$nl;
$output.= $t.$t.$t.'http://www.pouet.net/'.$nl;
$output.= $t.$t.$t.'88'.$nl;
$output.= $t.$t.$t.'31'.$nl;
$output.= $t.$t.$t.'your online demoscene resource'.$nl;
$output.= $t.$t.''.$nl;
// getting data
unset($posts);
$query ='SELECT id,topic,lastpost FROM bbs_topics ORDER BY lastpost DESC LIMIT '.$howmany;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
$topics[] = $row;
// publishing each prod as -
foreach($topics as $topic)
{
$output.= $t.$t.'
- '.$nl;
$output.= $t.$t.$t.''.xmlentities(utf8_encode($topic['topic'])).''.$nl;
$output.= $t.$t.$t.'http://www.pouet.net/topic.php?which='.$topic['id'].''.$nl;
$output.= $t.$t.$t.''.$topic['id'].''.$nl;
$output.= $t.$t.$t.''.date('D, d M Y H:i:s',strtotime($topic['lastpost'])).' CST'.$nl;
$output.= $t.$t.'
'.$nl;
}
$output.= $t.' '.$nl;
$output.= ''.$nl;
// closing DB
if (isset($dbl)) {
mysql_close($dbl);
}
// print('
'.$nl);
// print(htmlentities($output));
// print('
'.$nl);
print($output);
?>