<?
// userfree.php by AnDa for Single User OnlyUp Mod

require "include/bittorrent.php";

dbconn();

loggedinorreturn();

if (get_user_class() < UC_MODERATOR)
stderr("Sorry", "Access denied.");

stdhead("User mit Persönlichen OnlyUp");
begin_main_frame();
$userfree = number_format(get_row_count("users", "WHERE userfree='yes'"));
begin_frame("User mit Persönlichen OnlyUp: ($userfree)", true);
begin_table();

$res = mysql_query("SELECT * FROM users WHERE userfree=1 AND enabled='yes' ORDER BY (users.uploaded/users.downloaded)") or sqlerr();
$num = mysql_num_rows($res);
?>
<tr>
 <td class="tabletitle" width=120 align="left">User Name</td>
 <td class="tabletitle" width=75 align="left">OnlyUp bis</td>
 <td class="tabletitle" width=95 align="left">Letzte Aktivität</td>
 <td class="tabletitle" width=120 align="left">Benutzerrang</td>
 <td class="tabletitle" width=100 align="left">Downloaded</td>
 <td class="tabletitle" width=100 align="left">Uploaded</td>
 <td class="tabletitle" width=70 align="left">Ratio</td>
</tr>
<?
for ($i = 1; $i <= $num; $i++)
{
$arr = mysql_fetch_assoc($res);
if ($arr['added'] == '0000-00-00 00:00:00')
$arr['added'] = '-';
if ($arr['last_access'] == '0000-00-00 00:00:00')
$arr['last_access'] = '-';


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

$added = substr($arr['added'],0,10);
$last_access = substr($arr['last_access'],0,10);
$class=get_user_class_name($arr["class"]);
  $souuntil=($arr["souuntil"]);

print("<tr><td class=tableb align=center><a href=userdetails.php?id=$arr[id]><b>$arr[username]</b></a>" .($arr["donor"] =="yes" ? "<img src=/pic/star.gif border=0 alt='Donor'>" : "")."</td>
<td class=tableb align=center>$souuntil</td>
<td class=tableb align=center>$last_access</td>
<td class=tableb align=center>$class</td>
<td class=tableb align=center>$downloaded</td>
<td class=tableb align=center>$uploaded</td>
<td class=tableb align=center>$ratio</td></tr>\n");
}
end_table();
end_frame();
end_main_frame();
stdfoot();
die;

?>