File size: 1.93Kb
<?php
define('IN_SS', true);
include_once('./inc/init.php');
$title = 'Featured Files';
$folder = [];
$folder['name'] = 'Home';
$folder['use_icon'] = 0;
$act = $ss->get_input('act', 1);
include_once('./header.php');
include_once('./assets/ads/bcategory.php');
$options = ['order_by' => 'hits DESC', 'limit' => 3];
switch($act)
{
case '1':
$verb ='Yesterday';
$date = date("dmY", TIME_NOW-86400);
$query = $db->simple_select("download_history", "fid, hits", "date='{$date}'", $options);
break;
case '2':
$verb ='Week';
$date = date("dmY", TIME_NOW-604800);
$query = $db->simple_select("download_history", "fid, hits", "date>={$date}", $options);
break;
case '3':
$verb = 'Month';
$date = date("dmY", TIME_NOW-2592000);
$query = $db->simple_select("download_history", "fid, hits", "date>={$date}", $options);
break;
default:
$verb =' Today ';
$date = date("dmY", TIME_NOW);
$query = $db->simple_select("download_history", "fid, hits", "date='{$date}'", $options);
break;
}
// Category title
echo '<div id="category"><h2> Featured</h2></div>';
$total = $db->num_rows($query);
if($total != 0)
{
while($top = $db->fetch_array($query))
{
$query2 = $db->simple_select("files", "fid, name, size, path, pid", "fid='{$top['fid']}'");
$file = $db->fetch_array($query2);
if($file['pid'] != 0)
{
$query2 = $db->simple_select("files", "fid, use_icon", "fid='{$file['pid']}'");
$folder = $db->fetch_array($query2);
}
echo '<div class="fl"><a href="'.$ss->settings['url'].'/download/'.$file['fid'].'/'.convert_name($file['name']).'.html" class="fileName"><div><div>';
if(file_exists(SS_ROOT.'/thumbs/'.$file['fid'].'.png'))
{
echo '<img src="'.$ss->settings['url'].'/thumbs/'.$file['fid'].'.png" alt="'.escape($file['name']).'" width="60" height="65" />';
}
echo '</div><div>'.escape($file['name']).'</div></div></a></div>';
}
}
else
{
echo '<div class="toptitle">No Featured file</div>';
}