Hello,
I try to create a file today.php to show the torrents of the day according to the categories but now I do not manage to see the torrents etc.
Maybe you will see where my error
here is my code:
PHP Code:
<?php
/*
+--------------------------------------------------------------------------
| TS Special Edition v.7.5
| ========================================
| by xam
| (c) 2005 - 2015 Template Shares Services
| http://templateshares.net
| ========================================
| Web: http://templateshares.net
| Time: $_ts_date_
| Signature Key: $_ts_signature_key_
| Email: contact@templateshares.net
| TS SE IS NOT FREE SOFTWARE!
+---------------------------------------------------------------------------
*/
define('THIS_SCRIPT', 'today.php');
define('D_VERSION', '3.9.0 by xam');
define('SKIP_MOD_QUERIES', true);
define('SKIP_CACHE_MESSAGE', true);
require('global.php');
$lang->load('index');
$lang->load('global');
$TSSEConfig->TSLoadConfig('ANNOUNCE');
if($usergroups['candownload'] != 'yes' OR !isset($CURUSER))
{
print_no_permission(false);
}
$defaulttemplate = ts_template();
$Imagedir = $BASEURL.'/include/templates/'.$defaulttemplate.'/images/torrent_flags/';
$dimagedir = $BASEURL.'/include/templates/'.$defaulttemplate.'/images/';
$id = intval(TS_Global('id'));
function health($leechers, $seeders) {
if (($leechers == 0 && $seeders == 0) || ($leechers > 0 && $seeders == 0))
return 0;
elseif ($seeders > $leechers)
return 10 ;
$ratio = $seeders / $leechers * 100;
if ($ratio > 0 && $ratio < 15)
return 1;
elseif ($ratio >= 15 && $ratio < 25)
return 2;
elseif ($ratio >= 25 && $ratio < 35)
return 3;
elseif ($ratio >= 35 && $ratio < 45)
return 4;
elseif ($ratio >= 45 && $ratio < 55)
return 5;
elseif ($ratio >= 55 && $ratio < 65)
return 6;
elseif ($ratio >= 65 && $ratio < 75)
return 7;
elseif ($ratio >= 75 && $ratio < 85)
return 8;
elseif ($ratio >= 85 && $ratio < 95)
return 9;
else
return 10;
}
$date_time= TIMENOW - 86400; // the 24 is the hours you want listed
$catresult = sql_query("SELECT id, name, image,cat_desc,type,pid,canview,candownload FROM categories ORDER BY pid");
while($cat = mysqli_fetch_assoc($catresult))
{
$today .= '<b><a href="browse.php?category='.$cat["id"].'">'.$cat['name'].'</a></b><br><br>';
$today .= '<table width="100%" align="center" border="0" cellpadding="3" cellspacing="0"> <tbody>
<tr>
<td class="thead" width="1%">Cat.</td>
<td class="thead" align="left" width="67%">'.$lang->index['name'].'</td>
<td class="thead" align="center" width="12%">DL</td>
<td class="thead" align="center" width="12%">'.$lang->index['size'].'</td>
<td class="thead" align="center" width="10%">'.$lang->index['seeders'].'</td>
<td class="thead" align="center" width="10%">'.$lang->index['leechers'].'</td>
<td class="thead" align="center" width="10%">Uploadeur</td>
<td class="thead" align="center" width="10%">Santé</td>
</tr> ';
$lt_query = sql_query('SELECT t.*, c.id as catid, c.name as catname,c.cat_desc, c.image, c.canview,u.username, g.namestyle FROM torrents t LEFT JOIN categories c ON (t.category=c.id)LEFT JOIN users u ON (t.owner=u.id) LEFT JOIN usergroups g ON (u.usergroup=g.gid) WHERE t.moderate = 0 AND category='.$cat['id'].' AND torrents.added>='.$date_time.' ORDER BY t.id DESC LIMIT 10');
$torrents = mysqli_fetch_assoc($lt_query);
if (($torrents['offensive'] == 'yes' && TS_Match($CURUSER['options'], 'E0')) OR ($torrents['canview'] != '[ALL]' AND !in_array($CURUSER['usergroup'], explode(',', $torrents['canview']))))
{
continue;
}
$seolink = ts_seo($torrents['catid'],$torrents['catname'],'c');
$seolink2 = ts_seo($torrents['id'],$torrents['name'],'s');
$seolink3 = ts_seo($torrents['id'],$torrents['name'],'d');
$name = htmlspecialchars_uni($torrents['name']);
$cname = htmlspecialchars_uni($torrents['name']);
$cat = $torrents['catname'];
$parentcategory = $torrents['cat_desc'];
$balon = htmlspecialchars_uni($torrents['t_image']);
$health =" <img src=https://le-paradis-du-net.com/images/health/health_".health($torrents["leechers"], $torrents["seeders"]).".gif>";
$uploadeur = $torrents['username'];
$res = sql_query($lt_query);
$numtor = mysqli_num_rows($res);
if ($numtor != 0) {
$today .= '<tr>
<td align=left><b><img src="'.$pic_base_url.$table_cat.'/'.$torrents['image'].'" width="38" height="26" border="0" /></b></td>
<td align=left><b>'.cutename($torrents['name'], 50).'</b></td>
<td align="center">
<a href="'.$seolink3.'"><img src="'.$Imagedir.'dl.png" border="0" class="inlineimg" alt="Télécharger ce torrent" title="télécharger ce torrent" /></a>
</td>
<td align="center">
'.mksize($torrents['size']).'
</td>
<td align="center">
<font color=green>'.ts_nf($torrents['seeders']).' </font>
</td>
<td align="center">
<font color=red> '.ts_nf($torrents['leechers']).'</font>
</td>
<td align="center">
'.(!$is_mod && $torrents['owner'] != $CURUSER['id'] && $torrents['anonymous'] == 'yes' ? '
<div class="gray">
'.$lang->global['anonymous'].'
</div>' : '
<a href="'.ts_seo($torrents['owner'], $torrents['username'], 'u').'">'.get_user_color($torrents['username'], $torrents['namestyle']).'</a>
'.($torrents['anonymous'] == 'yes' ? '
<div class="gray">
'.$lang->global['anonymous'].'
</div>
' : '').'
').'
</td>
<td align="center">
'.$health .'
</td>
</tr>
';
}
}
$today .= '<br>';
$today .= '</table>';
stdhead("torrents du jour");
echo'<table align="center" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr valign="top">
<td valign="top" class="none">
<div style="padding-bottom: 15px;">
'.$today.'
</div>
</td>
</tr>
</tbody>
</table>
';
stdfoot();
?>