Просмотр файла mforum/rss.php

Размер файла: 974B
<?php
	header("Pragma: no-cache");
	require "inc.php";
	function BuildRss() 
	{
		$re=mysql_query("select * from forum order by pid desc limit 100");
		echo "<?xml version=\"1.0\" encoding=\"windows-1251\" ?>\n";
		echo "<rss version=\"2.0\">\n";
		echo "<channel>\n";
		echo "<title>Forum</title>\n";
		echo "<link></link>\n";
		echo "<description>$desc</description>";
		$t = date("Ymd");
		while($res=mysql_fetch_array($re))
		{
			$tt = $res['date'];
			$tt = ereg_replace('-', '', $tt);
			$t = $t -$tt;
			if ($t<7)
			{
				echo "<item>\n";
				echo "<title>$res[topic]</title>\n"; 
				echo "<link>$link</link>\n";
				echo "<description>$res[post]</description>\n"; 
				echo "<pubDate>$res[date]</pubDate>\n";
				echo "<guid>viewtop.php?pid=$res[pid]</guid>\n";
				echo "</item>"; 
			}
		}
		echo "</channel>\n";
		echo "</rss>";
	}
	$db=mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db($dbname,$db);
	BuildRss();
?>