<?php
require_once('basics.php');
header("Content-Type: application/rss+xml");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
echo "<rss version=\"2.0\">";
echo "<channel>";
	echo "<title>".SiteName." Products</title>";
echo "<link>".SiteURL."</link>";
echo "<description>Discountdiamondringsonline.com is your website for an exclusive collection of Certifed Diamonds Rings, Clarity Enhanced Diamond Engagement Rings, Certificate Non-Enhanced Diamonds and Diamond jewelry.</description>\n";
dbopen();

function cleaned($s)
{
	$symbols = array("&", "'");
	$replacements = array("&#38;","&#39;");
	return str_replace($symbols, $replacements, $s);
}
function goodtime($moment)
{
	return date("D, d M Y H:i:s",$moment);
}

	$result=mysql_query("SELECT ProductID, Photo, ProductName, ProductType, Cut, OurPrice, Description, Time FROM Products WHERE Visibility=1 ORDER BY Time DESC LIMIT 0,50");
	while($row=mysql_fetch_row($result))
	{
		echo "<item>\n";
			echo "<title>";
				echo cleaned(stripslashes($row[2]));				
			echo "</title>\n";
			echo "<link>";
				echo SiteURL."/item/$row[0]/".HyphenURL($row[2])."/";
			echo "</link>\n";
			echo "<description>";
				echo unbreak(cleaned(stripslashes($row[6])));
			echo "</description>\n";
			echo "<pubDate>";
				echo goodtime($row[7])." +0000";
			echo "</pubDate>\n";
			echo "<guid>";
				echo SiteURL."/blog/".$rown[1]."/".HyphenURL($rown[0])."/";
			echo "</guid>\n";
		echo "</item>\n";
	}
echo "</channel>\n</rss>\n";
?>
