<?php
if ($HTTP_GET_VARS['limit'])
{
$limit = $HTTP_GET_VARS['limit'];
}
else
{
$limit = 20;
}
if ($HTTP_GET_VARS['category'])
{
$action = "category";
$category = $HTTP_GET_VARS['category'];
}
elseif ($HTTP_GET_VARS['search'])
{
$action = "search";
$search = $HTTP_GET_VARS['search'];
}
else
{
$action = "all";
}
//conection code $linkID!!!
switch($action)
{
case "category":
$categories = array('xml', 'code', 'design', 'news', 'standards');
if (!in_array($category, $categories))
{
$query = "select link, headline, description from headlines order by id desc limit $limit";
}
else
{
$query = "select link, headline, description from headlines where category = '$category' order by id desc limit $limit";
}
$result = mysql_query($query, $linkID);
while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}
break;
case "search":
include("http://zan.terrabox.com/search.php?term=$search&xml=true");
$file = file("this");
foreach ($file as $line)
{
$this .= $line;
}
$results2 = unserialize($this);
for ($x=0; $x<$limit; $x++)
{
$return[] = $results2[$x];
}
break;
case "all":
$query = "select link, headline, description from headlines order by id desc limit $limit";
$result = mysql_query($query, $linkID);
while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}
break;
}
$now = date("D, d M Y H:i:s T");
$output = "<?xml version=\"1.0\"?>
<rss version=\"0.92\">
<channel>
<title>stargeek studios</title>
<link>http://www.stargeek.com/</link>
<description>Web Design/Development News.</description>
<language>en-us</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>
<managingEditor>zan@stargeek.com</managingEditor>
<webMaster>zan@stargeek.com</webMaster>
";
foreach ($return as $line)
{
$output .= "
<item rdf:about=\"http://www.stargeek.com/link.php?link=".htmlentities($line[link])."\">
<title>".htmlentities($line['headline'])."</title>
<link>http://www.stargeek.com/link.php?link=".htmlentities($line[link])."</link>
<description>".htmlentities(strip_tags($line[description]))."</description>
</item>";
}
$output .= "</channel></rss>";
echo $output;
?>