<?php


ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
hit_start();
dbconn(false);
loggedinorreturn();
hit_count();

$res = mysql_query("SELECT COUNT(*) FROM torrents WHERE torrents.multi > '0'") or die(mysql_error());
$row = mysql_fetch_array($res);
$count = $row[0];

$torrentsperpage = $CURUSER["torrentsperpage"];
if (!$torrentsperpage)
    $torrentsperpage = 15;

if ($count) {
    list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "multi.php?" . $addparam);
    $query = "SELECT torrents.id, torrents.category, torrents.leechers, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.last_action, torrents.comments,torrents.numfiles,torrents.filename,torrents.free, torrents.freeleech, torrents.highlight, torrents.owner, torrents.numpics, torrents.poster, torrents.multi, torrents.language,IF(torrents.nfo <> '', 1, 0) as nfoav," .
    // "IF(torrents.numratings < ".$GLOBALS["MINVOTES"].", NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, categories.name AS cat_name, categories.image AS cat_pic, users.username FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.multi >'0' ORDER BY added DESC $limit";
    "categories.name AS cat_name, categories.image AS cat_pic, users.username, users.class AS uploaderclass FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.multi >'0' ORDER BY added DESC $limit";
    $res = mysql_query($query) or die(mysql_error());
} else
    unset($res);
    stdhead();

?>
<br>
<table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td colspan="10" width="100%"><span class="normalfont"><center><b> Multiplikator Torrents</b></center></span></td>
 </tr></table>
<br>
<table cellpadding="4" cellspacing="1" border="0" style="width:100%" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td colspan="10" style="width:100%;text-align:center;" onclick="window.location='multi.php?incldead=1'"><span class="normalfont"><b>.::Die neusten Multiplikator Torrents mit Bild ::.</b></td></tr>
<table border=0 style=width:100% cellspacing=1 cellpadding=5 class=tableinborder>
    <tr class=tablea align=center><?
?>

</b></center></span></td>

 </tr><tr><td width="100%" class="tablea">

 <?
//Start mod
if($CURUSER[xxx] =='yes'){
$query="SELECT * FROM torrents WHERE poster <> '' AND activated !='no' AND multi !='no' ORDER BY added DESC limit 8";
}
else
{
$query="SELECT * FROM torrents WHERE poster <> '' AND activated !='no' AND multi !='no' AND category !='100' ORDER BY added DESC limit 8";
}

$result=mysql_query($query);$num = mysql_num_rows($result);
// count rows
print '<center><table border=0 cellspacing=0 cellpadding=5><tr>';
$i=20;
while ($row = mysql_fetch_assoc($result)) { $id = $row['id'];
print'<td>';

$cat = $arr7["name"];

$res8 = mysql_query("SELECT users.webseed FROM users JOIN peers ON users.id = peers.userid WHERE peers.torrent=$id AND users.webseed ='yes' AND peers.seeder = 'yes'") or sqlerr();
if (mysql_num_rows($res8) > 0) {
$wbs="<b><font color=yellow> [WEBSEED] </font></b>";
            }
else
{
$wbs="";
            }

$res81 = mysql_query("SELECT users.adsl FROM users JOIN peers ON users.id = peers.userid WHERE peers.torrent=$id AND users.adsl ='yes' AND peers.seeder = 'yes'") or sqlerr();
if (mysql_num_rows($res81) > 0) {
$adsl="<b><font color=yellow> [ADSL2] </font></b>";
            }
else
{
$adsl="";
            }

$res91 = mysql_query("SELECT users.vdsl FROM users JOIN peers ON users.id = peers.userid WHERE peers.torrent=$id AND users.vdsl ='yes' AND peers.seeder = 'yes'") or sqlerr();
if (mysql_num_rows($res91) > 0) {
$vdsl="<b><font color=yellow> [VDSL] </font></b>";
            }
else
{
$vdsl="";
            }

$free1 = mysql_query("SELECT * FROM torrents WHERE free = 'yes'") or sqlerr();
if  ($row[free]=="yes") {
$free1="<b><font color=yellow> [ONLY UPLOAD] </font></b>";
            }
else
{
$free1="";
            }

$size = mksize($row["size"]);

$res9=mysql_query("SELECT * FROM peers WHERE torrent=$id AND seeder = 'yes'") or sqlerr();
$seeder=mysql_num_rows($res9);
$res91=mysql_query("SELECT * FROM peers WHERE torrent=$id AND seeder != 'yes'") or sqlerr();
$leecher=mysql_num_rows($res91);

$name = $row['name'];
  $poster = $row['poster'];
$name = str_replace('_', ' ' , $name);
$name = str_replace('.', ' ' , $name);
$name = substr($name, 0, 50);
echo "<a href=\"/details.php?id=$id&hit=1\" onMouseover=\"ddrivetip('<table cellpadding=4 cellspacing=1 width=100% height=80><tr><td class=tablea align=left ><b><font color=white>$name</font></b><br><font color=green>$seeder Seeder</font><br><font color=red>$leecher Leecher</font><br>$wbs $adsl $vdsl $free1</td></tr></table>','red')\"
 onMouseout=\"hideddrivetip()\"><img src=$poster width=\"90\" height=\"120\" border=0></a>";
 $i++;
}
print'</td>';
echo "</center></table>";
//End of the mod
?>
</tr>
</td>
</table>
<br>
<?php


if ($count) {
    print($pagertop);

    torrenttable($res, "index", $addparam);

    print($pagerbottom);
}


stdfoot();

hit_end();

?>