0){ // Need to make sure its a valid category and get category name $sql_query = "SELECT * from categories WHERE status = 1 && id = $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['title']); $query = "SELECT * from items WHERE status = 1 && category = $feed ORDER by date DESC LIMIT $num"; $feedtitle = "Newest $categoryname"; } } else{ $query = "SELECT * from items WHERE status = 1 && category = $feed ORDER by date DESC LIMIT $num"; $feedtitle = "Newest Content"; } // End Category Check } else{ $query = "SELECT * from items WHERE status = 1 ORDER by date DESC LIMIT $num"; $feedtitle = "Newest Content"; } // Now write the header information $feed = ""; $feed.="$feedtitle from $sitename"; $feed.="$base_url"; $feed.="$sitedescription"; $feed.="en-us"; $feed.="".$base_url."rss.php"; if ($rewrite != 0 && $trackclicks != 0){ $result = mysql_query($query); if(mysql_num_rows($result)) { //output as long as there are still available fields while($row = mysql_fetch_array($result)) { $mediatitle = ucwords($row['title']); $mediatitle = ereg_replace("[^a-zA-Z0-9 ]", "", $mediatitle); $mediadescription = stripslashes($row['description']); $id = $row['id']; $title = strtolower($mediatitle); // remove all characters except spaces, a-z and 0-9 $title = ereg_replace("[^a-z0-9 ]", "", $title); // make all spaces single spaces $title = ereg_replace(" +", " ", $title); // replace spaces with - $title = str_replace(" ", "_", $title); $title = $title.".html"; if ($rewrite ==0) $itemlink = $base_url."out.php?id=".$id; else $itemlink = $base_url."media/".$id."/".$title; $feed.=" $mediatitle $mediadescription $itemlink "; } } } $feed.=""; mysql_close($connection); echo $feed; ?>