<?
require_once("include/bittorrent.php");
dbconn(true);

$query = "SELECT id, name, size, poster, seeders, leechers, free, numpics >=1 FROM torrents WHERE visible='yes' ORDER BY added DESC LIMIT 10"; 
$result = mysql_query($query);
$num = mysql_num_rows($result); // count rows
while ($row = mysql_fetch_assoc($result)){
$torrent_info["cat_name"] = $row["cat_name"];
$id = $row['id'];
$size = $row['size'];
$arr20 = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt FROM users LEFT JOIN peers ON peers.userid = users.id WHERE torrent=$id AND seeder='yes' AND  webseed='yes'")); 
$seeds1 = $arr20["cnt"];
$arr21 = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS cnt FROM users LEFT JOIN peers ON peers.userid = users.id WHERE torrent=$id AND seeder='yes' AND  adsl='yes'")); 
$seeds2 = $arr21["cnt"];
$bild = $row['id'];
$bild1 = ("bitbucket/t-".$bild."-1.jpg");
$poster = $row['poster'];
if (strlen($row['name']) > 32) 
$name = substr($row['name'], 0, 29) . "..."; 
else 
$name = $row['name']; 
$seeder = $row['seeders']; 
$leecher = $row['leechers']; 
?>
<? if($CURUSER){ ?><a href="details.php?id=<?=$id?>" target="blank" onMouseover="overlib('>=-----------><b>Torrent</b><-----------=<<br><hr></hr>&nbsp;<?=$name?><hr></hr>&nbsp;Seeder: <font color=green><?=$seeder?></font><br>&nbsp;Leecher: <font color=red><?=$leecher?></font><hr></hr>&nbsp;Größe: <?=mksize($row["size"])?>
<? if($seeds1 != 0) { echo '<hr></hr>&nbsp;<font color=yellow>Webseed</font>';} ?><? if($seeds2 != 0) { echo '<hr></hr>&nbsp;<font color=orange>ADSL2</font>';} ?><? if($row[free]=="yes") { echo '<hr></hr>&nbsp;<font color=blue>Only Upload</font>';}?><hr></hr>','#DDDDDD')" onMouseout="nd()"><? } ?><img src="<? if($row['poster'] != ""){echo"".$poster."";} else {echo"".$bild1."";} ?>" width="91" height="130" alt="Poster" style="border: 0px solid black;"/></a>
<?
}