-
Notifications
You must be signed in to change notification settings - Fork 29
/
subnet.php
93 lines (90 loc) · 4.12 KB
/
subnet.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?
/*
// +--------------------------------------------------------------------------+
// | Project: TBDevYSE - TBDev Yuna Scatari Edition |
// +--------------------------------------------------------------------------+
// | This file is part of TBDevYSE. TBDevYSE is based on TBDev, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | TBDevYSE is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | TBDevYSE is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with TBDevYSE; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
function ratios($up,$down, $color = True)
{
if ($down > 0)
{
$r = number_format($up / $down, 2);
if ($color)
$r = "<font color=".get_ratio_color($r).">$r</font>";
}
else
if ($up > 0)
$r = "Inf.";
else
$r = "---";
return $r;
}
$mask = "255.255.255.0";
$tmpip = explode(".",$CURUSER["ip"]);
$ip = $tmpip[0].".".$tmpip[1].".".$tmpip[2].".0";
$regex = "/^(((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))(\.\b|$)){4}$/";
if (substr($mask,0,1) == "/")
{
$n = substr($mask, 1, strlen($mask) - 1);
if (!is_numeric($n) or $n < 0 or $n > 32)
{
stdmsg($tracker_lang['error'], "Íåâåðíàÿ ìàñêà ïîäñåòè.");
stdfoot();
die();
}
else
$mask = long2ip(pow(2,32) - pow(2,32-$n));
}
elseif (!preg_match($regex, $mask))
{
stdmsg("Îèøáêà", "Íåâåðíàÿ ìàñêà ïîäñåòè.");
stdfoot();
die();
}
$res = sql_query("SELECT id, username, class, last_access, added, uploaded, downloaded FROM users WHERE enabled='yes' AND status='confirmed' AND id <> $CURUSER[id] AND INET_ATON(ip) & INET_ATON('$mask') = INET_ATON('$ip') & INET_ATON('$mask')") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res)){
stdhead("Ñåòåâûå ñîñåäè");
print("<table border=1 cellspacing=0 cellpadding=5>\n");
print("<tr><td class=colhead align=center colspan=8>:: Ñåòåâûå ñîñåäè ::</td></tr><tr><td colspan=8>Ýòè ïîëüçîâàòåëè âàøè ñåòåâûå ñîñåäè, ÷òî îçíà÷àåò ÷òî âû ïîëó÷èòå îò íèõ ñêîðîñòü âûøå.</td></tr>");
print("<tr><td class=colhead align=left>Ïîëüçîâàòåëü</td>
<td class=colhead>Ðàçäàë</td><td class=colhead>Ñêà÷àë</td>
<td class=colhead>Ðåéòèíã</td><td class=colhead>Çàðåãèñòðèðîâàí</td>
<td class=colhead>Ïîñëåäíèé äîñòóï</td><td class=colhead align=left>Êëàññ</td>
<td class=colhead>IP</td></tr>\n");
while($arr=mysql_fetch_assoc($res)){
print("<tr><td align=left><b><a href=userdetails.php?id=$arr[id]>".get_user_class_color($arr["class"], $arr["username"])."</a></b></td>
<td>".mksize($arr["uploaded"])."</td>
<td>".mksize($arr["downloaded"])."</td>
<td>".ratios($arr["uploaded"],$arr["downloaded"])."</td>
<td>$arr[added]</td><td>$arr[last_access]</td>
<td align=left>".get_user_class_name($arr["class"])."</td>
<td>".$tmpip[0].".".$tmpip[1].".".$tmpip[2].".*</td></tr>\n");
}
print("</table>");
stdfoot();}
else
stderr("Èíôîðìàöèÿ","Ñåòåâûõ ñîñåäåé íå îáíàðóæåíî.");
?>