if ($CURUSER) {
// Get the torrents with leechers but no seed.
$sn_lines = array();
$tnsr = mysql_query("SELECT t1.id, t1.name, t1.size, t1.leechers, t2.to_go FROM torrents AS t1, peers AS t2 WHERE t2.torrent = t1.id AND seeders = 0 AND leechers > 0 AND t1.access = ".AL_COMMON." ORDER BY t1.leechers DESC, t2.to_go DESC") or sqlerr();
while ($tnsa = mysql_fetch_assoc($tnsr)) {
if($tnsa['to_go'] >= $tnsa['size'])
continue;
$perc = round((($tnsa['size'] - $tnsa['to_go']) / $tnsa['size']) * 100, 2) . "%";
$work[$tnsa['id']] = $tnsa['to_go'];
$sn_lines[$tnsa['id']] = '' . $tnsa['name'] . ' (' . $tnsa['leechers'] . ($tnsa['leechers'] == 1 ? " Качают, $perc" : " Качают, $perc ") . " завершено)";
}
print("Релизы, которым нужны раздающие
");
if (count($st_lines)) {
foreach ($st_lines as $line) {
echo("$line\n");
}
}
if (count($sn_lines)) {
echo('
| ");
foreach ($sn_lines as $line) {
echo("$line \n"); } echo("\n"); echo(" |