<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();

if (get_user_class() < UC_MODERATOR)
stderr("Fehler", "Das ist nichts für dich!");

$invites = number_format(get_row_count("users", "WHERE invitedby >= '2'"));

stdhead("Invitete User");
begin_frame("Invitete User", true);

$res = mysql_query("SELECT * FROM users WHERE invitedby >='2' ORDER BY (users.username)") or sqlerr();
$num = mysql_num_rows($res);
print("<br>");
print("<table align=center cellpadding=4 cellspacing=1 border=0 style=width:790px class=tableinborder>
<tr class=tabletitle width=100%>
<td colspan=10 width=100%><span class=normalfont><center><b>Liste aller User die per invite auf den Tracker gekommen sind. ($invites)</b><center></span></td></tr>
<tr><td width=100% class=tableb>");

print("<p><table align=center width=780 border=0 cellspacing=1 cellpadding=5 class=tableinborder><tr>
<td align=left style=width:15% class=tablecat><b>User</b></td>
<td align=left style=width:15% class=tablecat><b>Reg. am</b></td>
<td align=left style=width:15% class=tablecat><b>Zuletzt On</b></td>
<td align=center style=width:15% class=tablecat><b>Download</b></td>
<td align=center style=width:15% class=tablecat><b>Upload</b></td>
<td align=center style=width:10% class=tablecat><b>Ratio</b></td>
<td align=left style=width:15% class=tablecat><b>Inviter</b></td>
</tr>");

if (mysql_num_rows($res) == "0") {
print("<tr><td align=left class=tableb colspan=7><b>Zur Zeit ist kein User in der Liste!</b></td></tr></table>");
print("</tr></td></table>");
print("<br>");
end_frame();
stdfoot();
exit;
}

for ($i = 1; $i <= $num; $i++)
{
$arr = mysql_fetch_assoc($res);
if ($arr['added'] == '0000-00-00 00:00:00')
$arr['added'] = '-';
$added = substr($arr['added'],0,10);

if ($arr['last_access'] == '0000-00-00 00:00:00')
$arr['last_access'] = '-';
$last_access = substr($arr['last_access'],0,10);

$uploaded = mksize($arr["uploaded"]);
$downloaded = mksize($arr["downloaded"]);

if($arr["downloaded"] != 0){
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
} else {
$ratio = '---';
}
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";

$res1 = mysql_query("SELECT * FROM users WHERE id = $arr[invitedby]") or sqlerr();
$arr1 = mysql_fetch_assoc($res1);

print("<tr>
<td align=left class=tableb><a href=userdetails.php?id=$arr[id]><b><font class=" .get_class_color($arr["class"]) . ">$arr[username]" .($arr["donor"] =="yes" ? "<img src=/pic/star.gif border=0 alt='Donor'>" : "")."</td>
<td align=left class=tablea>$added</td>
<td align=left class=tableb>$last_access</td>
<td align=center class=tableb>$downloaded</td>
<td align=center class=tablea>$uploaded</td>
<td align=center class=tableb>$ratio</td>
<td align=left class=tablea><a href=userdetails.php?id=$arr[invitedby]><b><font class=" .get_class_color($arr1["class"]) . ">$arr1[username]" .($arr1["donor"] =="yes" ? "<img src=/pic/star.gif border=0 alt='Donor'>" : "")."</td>
</tr>");
}
print("</tr></td></table>");
print("</tr></td></table>");
end_frame();
stdfoot();
die;

?>