/* LOAD CACHED PAGE */
$file = "cache/main-".(int)$_GET['sort']."-".(int)$_GET['day'].".html";
$timeout = 1; // 5 minutes
$cache_age = @time() - @filemtime($file);
// we refresh the content
if (!file_exists($file) || (file_exists($file) && $cache_age > $timeout) )
{
touch($file);
$fp = @fopen($file, "w+b");
$sort = tsort ($_GET['sort']);
/////////////////////////////////
$news = mysql_query("SELECT * FROM top5 ORDER BY date DESC LIMIT 5")or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($news) > 0) {
$output .= '
Select you preferred Top5 by clicking on the category below';
$output .='All - Movies - Games -
XXX - Music';
?>
$output .= '';
$output .= "
";
$cat_sorting = array("Movies" => 3, "XXX" => 1, "Games" => 1, "Music" =>1);
foreach ($cat_sorting as $cat => $lim)
{
$news = mysql_query("SELECT * FROM top5 WHERE category = '".$cat."' ORDER BY date DESC LIMIT ".$lim."")or sqlerr(__FILE__, __LINE__);
while ($row = mysql_fetch_array($news)) {
extract($row);
$output .= " | ";
}
}
$output .= "
";
$output .= "
";
}
/////////////Mod to show torrents from today and the last five days selectable
$j = date('Y');
$m = date('m');
$d = date('d');
$count = 0;
$tage = 7;
//$output .= "";
while ($count<$tage){
$tag = date('d.m.Y',mktime(0,0,0,$m,$d-$count,$j));
$output .= " $tag";
$count++;}
//$output .= "
";
$j = date('Y');
$m = date('m');
$d = date('d');
$morgen = date('Y-m-d',mktime(0,0,0,$m,$d+1,$j));
$heute = date('Ymd');
$heute = (isset($_GET['day']) && $_GET['day'] >= 1 && $_GET['day'] <= 4) ? date('Y-m-d', strtotime('-' . ($_GET['day']+0) . ' day')) : date('Y-m-d');
?>
$res85 = mysql_query("SELECT COUNT(*) FROM torrents WHERE torrents.datum='$heute'") or sqlerr();
$arr85 = mysql_fetch_row($res85);
$number = $arr85[0];
$output .= "Wenn Ihr eure Torrents eintragt, BITTE lasst irgendwelche speziellen Bezeichnungen weg. Ich meine im speziellen Mystik Torrent, von denen ein paar Spezialisten alles mögliche im Filenamen haben
nur nicht das worum es wirklich geht! Also BITTE stellt Euch nicht so doof an und macht es richtig, so bleiben Eure Files auch in der Liste...";
$output .= "| Torrents posted Today:".$number." |
";
$output .= "Torrents vom: " .date_mysql2german($heute). "
\n";
$date=date("d.m.y - H:i", time());
/////////////////////////////////////////////////////
foreach ($catt as $catval)
{
$result = mysql_query("SELECT * FROM torrents LEFT JOIN filetype ON torrents.filetype = filetype.tid LEFT JOIN categories ON torrents.subcat = categories.subid WHERE maincat = '$catval' AND torrents.datum='$heute' $sort")or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
{
}
else
{
$output .= '
';
$output .= '