<?php
require "include/bittorrent.php";

dbconn();

loggedinorreturn();

if (get_user_class() < UC_MODERATOR)
        stderr("Sorry", "Das nix für dich.");
stdhead("...Overspeed... ::");
print("<h2><b>Overspeed</h2></b><br>");


$res = mysql_query("SELECT count(*) FROM traffic INNER JOIN users INNER JOIN torrents WHERE users.id=traffic.userid AND traffic.torrentid=torrents.id AND traffic.downloaded/traffic.downloadtime >= 2100000 AND users.webseed='no' ORDER BY users.username ASC") or sqlerr();
$row = mysql_fetch_array($res);
$count = $row[0];


begin_frame();

 
print("<center>");
print("<b>Hier sind alle user aufgelistet, die mit mehr als 2MB/s gesaugt haben ohne Webseedanmeldung</b><br>");

begin_table();

if ($count!=0)
{
print("<table border=0 cellspacing=0 width=750 cellpadding=5>\n");
print("<tr><td class=tableb align=left><center>User name</td><td class=tableb><center>Torrent</td><td class=tableb><center>DL Speed</td></tr>\n");
//print("<tr><br><td class=\"left\"><b>User name</td><td><b>Torrent</td><td><b>DL Speed</td></tr>\n");



$res3 = mysql_query("SELECT torrents.name AS tname, torrents.id AS tid, users.username, users.webseed, traffic.userid, traffic.uploaded AS uploaded, traffic.downloaded AS downloaded, traffic.downloadtime AS downloadtime, traffic.uploadtime AS uploadtime FROM traffic INNER JOIN users INNER JOIN torrents WHERE users.id=traffic.userid AND traffic.torrentid=torrents.id AND traffic.downloaded/traffic.downloadtime >= 2100000 AND users.webseed='no' ORDER BY users.username ASC") or sqlerr();

while($arr = mysql_fetch_assoc($res3))
{
echo '<tr><td class="left"><a href="userdetails.php?id='.$arr['userid'].'">'.$arr['username'].'</a></td>';
echo '<td class="left"><a href="details.php?id='.$arr['tid'].'">'.$arr['tname'].'</a></td>';
echo '<td class="left">' . mksize($arr["downloaded"] / max(1, $arr["downloadtime"])) . '/s</td></tr>';
}
}
else
print("<tr><br><td><b><font color=red>.... ---- ==== Kein Overspeeder da ==== ---- ....</font><b></td></tr>\n");


print("</center>");

end_table();
end_frame();

stdfoot();
?>