Try
PHP Code:
<?
/*
script: rss.php
purpose: This script displays the RSS feeds.
copyright: copyright 2006 phpArcadeScript & Scott Lewis. All Rights Reserved. You may modify this file for use on your
site running a licenced copy of phpArcadeScript.
You must not distribute this file or derivations of it.
support: www.phparcadescript.com
*/
//error_reporting(0);
/* fix by Clixus Team */
if(isset($_GET['limit']) and !is_numeric($_GET['limit'])){
header("Location: index.php");
}
header('Content-type: text/xml');
include("./includes/config.php");
include("./includes/functions.php");
$feed = clean_string($_GET['type']);
$num = clean_string($_GET['limit']);
if (empty($num) || $num < 1)
$num = 10;
if ($feed == "newest_content"){
$query = "SELECT * from games WHERE gamestatus = 1 ORDER by dateadded DESC LIMIT $num";
$feedtitle = "Newest Content";
}
elseif ($feed == "most_popular"){
$query = "SELECT * from games WHERE gamestatus = 1 ORDER by timesplayed DESC LIMIT $num";
$feedtitle = "Most Popular Content";
}
elseif ($feed == "random_content"){
$query = "SELECT * from games WHERE gamestatus = 1 ORDER by RAND() LIMIT $num";
$feedtitle = "Random Content";
}
elseif ($feed > 0){
// Need to make sure its a valid category and get category name
$sql_query = "SELECT * from categories WHERE catid = '$feed' LIMIT 1";
$result2 = mysql_query($sql_query);
if(mysql_num_rows($result2))
{
//output as long as there are still available fields
while($row = mysql_fetch_array($result2))
{
$categoryname = stripslashes($row['catname']);
$query = "SELECT * from games WHERE gamestatus = 1 && category = '$feed' ORDER by dateadded DESC LIMIT $num";
$feedtitle = "Newest $categoryname";
}
}
else{
$query = "SELECT * from games WHERE gamestatus = 1 && category = '$feed' ORDER by dateadded DESC LIMIT $num";
$feedtitle = "Newest Content";
}
// End Category Check
}
else{
$query = "SELECT * from games WHERE gamestatus = 1 ORDER by dateadded DESC LIMIT $num";
$feedtitle = "Newest Content";
}
// open a file pointer to an RSS file
//$fp = fopen ("rss.xml", "w");
$site_title = stripslashes($site_title);
$site_desc = stripslashes($site_desc);
// Now write the header information
$feed = "<?xml version='1.0' ?><rss version='2.0'><channel>";
$feed.="<title>$feedtitle from $site_title</title>";
$feed.="<link>$base_url</link>";
$feed.="<description>$sitedescription</description>";
$feed.="<language>en-us</language>";
$feed.="<docs>".$base_url."rss.php</docs>";
$result = mysql_query($query);
if(mysql_num_rows($result))
{
//output as long as there are still available fields
while($row = mysql_fetch_array($result))
{
$gametitle = stripslashes($row['gametitle']);
$gametitle = ereg_replace("[^a-zA-Z0-9 ]", "", $gametitle);
$gametitle2 = make_friendly($gametitle);
$gamedescription = stripslashes($row['gamedesc']);
$gamedescription = ereg_replace("[^a-zA-Z0-9 ]", "", $gamedescription);
$gameid = $row['gameid'];
$gameicon=$row['gameicon'];
$iconlocation=$row['iconlocation'];
if ($rewrite ==0)
$gamelink = $base_url."index.php?action=playgame&gameid=".$gameid;
else
$gamelink = $base_url.$sedir."/".$gameid."/".$gametitle2;
if($iconlocation==0)
$gameicon=$base_url."games/images/".$gameicon;
$gamelink = htmlentities($gamelink);
$dateadded = gmdate('r',$row['dateadded']);
$feed.="
<item>
<title>$gametitle</title>
<description>$gamedescription</description>
<link>$gamelink</link>
<image>$gameicon</image>
<pubDate>{$dateadded}</pubDate>
</item>
";
}
}
$feed.="</channel></rss>";
mysql_close($connection);
echo $feed;
?>