<? header('Content-type: text/xml'); ?>
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>
<rss version="2.0">

<channel>
<title>PSP Desktops - Daily Random</title>
<link>http://www.pspdesktops.com/</link>
<description>The most random wallpapers</description>

<?php

include("../_functions.php");

$sql = 'SELECT * FROM `tblwalls` ORDER BY RAND() LIMIT 30';
$query = mysql_query($sql);

$chartno = 1;

while ($row = mysql_fetch_array($query)) {

$tcat = $row['category'];
$tsubcat = $row['subcategory'];
$submitter = $row['submitter'];
$turl = $row['url'];
$id = $row['ID'];
$views = $row['visits'];
$format = date("d M Y 00:00:00") ;
$datetime = "$format GMT";


$link = "http://www.pspdesktops.com/display.php?view=gallery&amp;wallid=".$id."";

echo "<item>";
echo "<title>Number $chartno of your random 30</title>";
echo "<link>$link</link>";
echo "<description><![CDATA[<img src=\"http://www.pspdesktops.com".$turl."\" alt=\"$submitter\" /><br />This wallpaper has had $views views and was submitted by $submitter]]></description>";
echo "<guid isPermaLink=\"true\">$link</guid>";
echo "<pubDate>$datetime</pubDate>";
echo "</item>";
echo " ";

$chartno++;

}
?>

</channel>
</rss>