<?php
header('Content-type: text/xml version="2.0" encoding="UTF-8"');
include("system/config.inc.php");
?>
<rss version="2.0">
<channel>
<title><?php echo htmlentities(strip_tags($title)); ?></title>
<description><?php echo htmlentities(strip_tags($title)); ?>, Free Submission and Free Content!</description>
<link><?php echo $site_URL; ?></link>
<copyright>Copyright <?php echo htmlentities(strip_tags($title)); ?> 2006</copyright>
<?php
//get timestamp for past/future date I want
$pf_time = strtotime("-1 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$link = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ("Could not connect to MySQL");
mysql_select_db ($dbname) or die ("Could not select database $dbname");
$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);

if ($num_rows <= 4){

 //get timestamp for past/future date I want
$pf_time = strtotime("-2 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);
}

if ($num_rows <= 4){

 //get timestamp for past/future date I want
$pf_time = strtotime("-3 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);
}

if ($num_rows <= 4){

 //get timestamp for past/future date I want
$pf_time = strtotime("-10 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);
}

if ($num_rows <= 4){

 //get timestamp for past/future date I want
$pf_time = strtotime("-20 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);
}

if ($num_rows <= 4){

 //get timestamp for past/future date I want
$pf_time = strtotime("-30 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);

$doGet = mysql_query("SELECT intId,intCategory,varArticleTitle,textSummary,ttSubmitDate FROM tblarticles WHERE ttSubmitDate > '$pf_date' ORDER BY ttSubmitDate DESC LIMIT 5")or die(mysql_error());
$num_rows = mysql_num_rows($doGet);
}


while($result = mysql_fetch_array($doGet)){
?>
<item> 
        <title> <?php echo htmlentities(strip_tags($result['varArticleTitle'])); ?></title> 
        <description> <?php echo htmlentities(strip_tags($result['textSummary'],'ENT_QUOTES'));?></description> 
        <link><?php echo $site_URL; ?>articledetail.php?artid=<?php echo $result['intId']; ?>&#38;catid=<?php echo $result['intCategory']; ?></link> 
         
     </item>  
<?
}
?>
</channel>
</rss>
