<?php
 

session_start();
include("include/config.php");
include("include/functions/import.php");
$thebaseurl = $config['baseurl'];

$getfilter = htmlentities(strip_tags($_REQUEST[c]));
$filter = escape($getfilter);
$showmax = $config['max_recent_main'];

if ($filter =="recentuploads")
{
	$query = "SELECT * from videos where public='1' AND active='1' order by VIDEOID desc limit $showmax";
}

header("Content-Type: text/xml"); 
header("Expires: 0"); 
print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 
print "<VIDEOS>\n"; 

$db=mysql_connect ($DBHOST,$DBUSER,$DBPASSWORD) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($DBNAME); 
  
$result = mysql_query($query) or die ('Query Error: ' . mysql_error()); 
while ($results = mysql_fetch_array($result)) 
{ 
  	$thumbnail       = $config['thumburl']."/".$results['VIDEOID']."-1.jpg"; 
  	$video       = $config['baseurl']."/videos/".$results['VIDEOID']."/".seo_clean_titles_sendmail($results['title']); 
  	$description = str_replace ("&amp","",htmlspecialchars(stripslashes($results['description']))); 
  	$duration = $results['runtime']; 
	$mins = floor($duration/60);
	$secs = round(($duration - ($mins * 60)),0);
	$duration = $mins.":".$secs;
	
	print "<ROW "; 
	print "title=\"".seo_clean_titles_regular($results['title'])."\" ";
	print "url=\"".$video."\" "; 
	print "v=\"\" "; 
	print "image=\"".$config['thumburl']."/".$results['VIDEOID']."-3.jpg"."\" "; 
	print "username=\"\" ";
	print "time=\"$duration\" "; 
	print "></ROW>\n"; 
} 
mysql_close(); 
print "</VIDEOS>\n"; 
?> 