<?
//////////////////////Doppelte IP´s Genehmigen und Verwalten by bliZZarD for bt-technik//////////////A////////
require "include/bittorrent.php";

dbconn();

loggedinorreturn();
$links = "";
if (isset($_GET['all_acc'])) {
$links = " (<a href=\"doppelip.php\">Ausser gebannte Acc´s</a>)";
} else {
$links = " (<a href=\"doppelip.php?all_acc=1\">Inklusive Gebannter Acc´s und Erlaubter Acc´s</a>)";
}
stdhead("Doppelte IP´s ");
begin_frame("Doppelte IP´s : $links", true);

print"<div align=Center><p><b>Achtung ein Aufruf an alle STAFF-Mitglieder. Es gibt Proxys, Studentenwohnheime, Heimnetzwerke, und unsere User aus AT (Österreich,Schweiz)! Schaut euch die Liste genau an, und fragt lieber vorher einen Admin, als direkt zu bannen. Proxys werden grundsätzlich erstmal verwarnt, und dann überprüft. Bei Fragen, Problemen, oder sonstiges über diesen Mod, meldet euch beim Chef. </b><hr></hr></p>";

if (get_user_class() >= UC_CO_ADMIN)
{
print"<div align=Center><p><b><u><a href=dipok.php><font size=2 color=red>>>>>>Genehmigte Tracker IP´s Ansehen<<<<<</font></u></b></a><p></div>";
}

begin_table();
if ($CURUSER["id"] != $user["id"])
{
if (get_user_class() >= UC_MODERATOR)
{
$showgetid = isset($_GET['all_acc']) ? '' : "enabled='yes' AND status='confirmed' AND dipok='no' AND ";
$res = mysql_query("SELECT COUNT(id) AS counting, ip FROM users WHERE $showgetid ip<>'' GROUP BY ip HAVING counting>1 ORDER BY counting DESC, ip ASC") or sqlerr();
$num = mysql_num_rows($res);
print("<tr align=center><td class=tablecat width=90>Mitglied</td>
<td class=tablecat width=70>Email</td>
<td class=tablecat width=70>Registriert</td>
<td class=tablecat width=75>Zuletzt Aktiv</td>
<td class=tablecat width=45>Hochgeladen</td>
<td class=tablecat width=45>Runtergeladen</td>
<td class=tablecat width=45>Ratio</td>
<td class=tablecat width=40>Peer-IP</td>
<td class=tablecat width=125>Login-IP</td>
<td class=tablecat width=40>Unique-Accs</td></tr>\n");

$uc = 0;
while($ras=mysql_fetch_assoc($res))
{
if ($ip <> $ras['ip'])
{
$ros = mysql_query("SELECT * FROM users WHERE $showgetid ip='".$ras['ip']."' ORDER BY id") or sqlerr();
$num2 = mysql_num_rows($ros);
if ($num2 > 1) 
{
$uc++;
while($arr = mysql_fetch_assoc($ros))
{
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"]);
$added = substr($arr['added'],0,10);
$last_access = substr($arr['last_access'],0,10);


$uidres = mysql_query("SELECT DISTINCT(`chash`) FROM `accounts` WHERE `userid`=" . $arr['id']);
        $acccnt = 0;
        while ($chash = mysql_fetch_assoc($uidres)) {
        $ucntarr = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS `cnt` FROM `accounts` WHERE `chash`="
        . sqlesc($chash["chash"]) . " AND `userid`<>" . $arr['id']));
        $acccnt += $ucntarr["cnt"];
}
if($uc%2 == 0)
$utc = "A9A9A9";
else
$utc = "808080";
$peer_res = mysql_query("SELECT count(*) FROM peers WHERE ip = " . sqlesc($ras['ip']) . " AND userid = " . $arr['id']);
$peer_row = mysql_fetch_row($peer_res);
print("<tr bgcolor=\"#$utc\"><td align=left><b><a href='/userdetails.php?id=" . $arr['id'] . "'>" . $arr['username']."</b></a>" . get_user_icons($arr) . "</td>
<td align=center>$arr[email]</td>
<td align=center>$added</td>
<td align=center>$last_access</td>
<td align=center>$uploaded</td>
<td align=center>$downloaded</td>
<td align=center>$ratio</td>
<td align=center>$arr[ip]</td>\n<td align=center>" .
($peer_row[0] ? "ja" : "nein") . "</td>");
$ip = $arr["ip"];
if ($acccnt == 0){
print"<td bgcolor=\"#$utc\"><center>-</center></td>";
}
else
{
print"<td bgcolor=\"#$utc\"><center><a
href=\"startstoplog.php?op=acclist&amp;id=$arr[id]\"><b><font color=red>".$acccnt."</font></b></a></center></td>";
}
}
}
}
}
}
else
{
print("</tr><br><table width=60% border=1 cellspacing=0 cellpadding=9><tr><td align=center>");
print("<h2>Zugang Verboten.</h2></table></td></tr>");
}
}
end_table();
stdfoot();
//////////////////////Doppelte IP´s Genehmigen und Verwalten by bliZZarD for bt-technik//////////////E////////
?>