/
invite.php
160 lines (139 loc) · 7.51 KB
/
invite.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?
/*
// +--------------------------------------------------------------------------+
// | 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_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
$id = intval($_GET["id"]);
$type = unesc($_GET["type"]);
$invite = $_GET["invite"];
stdhead("Ïðèãëàøåíèÿ");
function bark($msg) {
stdmsg("Îøèáêà", $msg);
stdfoot();
}
if ($id == 0) {
$id = $CURUSER["id"];
}
$res = sql_query("SELECT invites FROM users WHERE id = $id") or sqlerr(__FILE__,__LINE__);
$inv = mysql_fetch_assoc($res);
if ($inv["invites"] != 1) {
$_s = "íèé";
} else {
$_s = "èå";
}
if ($type == 'new') {
print("<form method=get action=takeinvite.php>".
"<input type=hidden name=id value=$id />".
"<table border=1 width=100% cellspacing=0 cellpadding=5>".
"<tr class=tabletitle><td colspan=2><b>Ñîçäàòü ïðèãëàñèòåëüíûé êîä (îñòàëîñü $inv[invites] ïðèãëàøå$_s)</b></td></tr>".
"<tr class=tableb><td align=center colspan=2><input type=submit value=\"Ñîçäàòü\"></td></tr>".
"</form></table>");
} elseif ($type == 'del') {
$ret = sql_query("SELECT * FROM invites WHERE invite = ".sqlesc($invite)) or sqlerr(__FILE__,__LINE__);
$num = mysql_fetch_assoc($ret);
if ($num[inviter]==$id) {
sql_query("DELETE FROM invites WHERE invite = ".sqlesc($invite)) or sqlerr(__FILE__,__LINE__);
sql_query("UPDATE users SET invites = invites + 1 WHERE id = $CURUSER[id]") or sqlerr(__FILE__,__LINE__);
stdmsg("Óñïåøíî", "Ïðèãëàøåíèå óäàëåíî. Ñåé÷àñ ìû âàñ ïåðåàäðåñóåì íà ñòðàíèöó ïðèãëàøåíèé...");
} else
stdmsg("Îøèáêà", "Âàì íå ðàçðåøåíî óäàëÿòü ïðèãëàøåíèÿ.");
header("Refresh: 3; url=invite.php?id=$id");
} else {
if (get_user_class() <= UC_UPLOADER && !($id == $CURUSER["id"])) {
bark("Ó âàñ íåò ïðàâà âèäåòü ïðèãëàøåíèÿ ýòîãî ïîëüçîâàòåëÿ.");
}
$rel = sql_query("SELECT COUNT(*) FROM users WHERE invitedby = $id") or sqlerr(__FILE__,__LINE__);
$arro = mysql_fetch_row($rel);
$number = $arro[0];
$ret = sql_query("SELECT id, username, class, email, uploaded, downloaded, status, warned, enabled, donor, email FROM users WHERE invitedby = $id") or sqlerr(__FILE__,__LINE__);
$num = mysql_num_rows($ret);
print("<form method=post action=takeconfirm.php?id=$id><table border=1 width=100% cellspacing=0 cellpadding=5>".
"<tr class=tabletitle><td colspan=7><b>Ñòàòóñ ïðèãëàøåííûõ âàìè</b> ($number)</td></tr>");
if(!$num) {
print("<tr class=tableb><td colspan=7>Åùå íèêòî âàìè íå ïðèãëàøåí.</tr>");
} else {
print("<tr class=tableb><td><b>Ïîëüçîâàòåëü</b></td><td><b>Email</b></td><td><b>Ðàçäàë</b></td><td><b>Ñêà÷àë</b></td><td><b>Ðåéòèíã</b></td><td><b>Ñòàòóñ</b></td>");
if ($CURUSER[id] == $id || get_user_class() >= UC_SYSOP)
print("<td align=center><b>Ïîäòâåðäèòü</b></td>");
print("</tr>");
for ($i = 0; $i < $num; ++$i) {
$arr = mysql_fetch_assoc($ret);
if ($arr[status] == 'pending')
$user = "<td align=left>$arr[username]</td>";
else
$user = "<td align=left><a href=userdetails.php?id=$arr[id]>" . get_user_class_color($arr["class"], "$arr[username]") . "</a>" . ($arr["warned"] == "yes" ? " <img src=pic/warned.gif border=0 alt='Warned'>" : "") . ($arr["enabled"] == "no" ? " <img src=pic/disabled.gif border=0 alt='Disabled'>" : "") . ($arr["donor"] == "yes" ? " <img src=pic/star.gif border=0 alt='Donor'>" : "")."</td>";
if ($arr["downloaded"] > 0) {
$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
} else {
if ($arr["uploaded"] > 0) {
$ratio = "Inf.";
} else {
$ratio = "---";
}
}
if ($arr["status"] == 'confirmed')
$status = "<a href=userdetails.php?id=$arr[id]><font color=green>Ïîäòâåðæäåí</font></a>";
else
$status = "<font color=red>Íå ïîäòâåðæäåí</font>";
print("<tr class=tableb>$user<td>$arr[email]</td><td>" . mksize($arr[uploaded]) . "</td><td>" . mksize($arr[downloaded]) . "</td><td>$ratio</td><td>$status</td>");
if ($CURUSER[id] == $id || get_user_class() >= UC_SYSOP) {
print("<td align=center>");
if ($arr[status] == 'pending')
print("<input type=\"checkbox\" name=\"conusr[]\" value=\"" . $arr[id] . "\" />");
print("</td>");
}
print("</tr>");
}
}
if ($CURUSER[id] == $id || get_user_class() >= UC_SYSOP) {
print("<input type=hidden name=email value=$arr[email]>");
print("<tr class=tableb><td colspan=7 align=right><input type=submit value=\"Ïîäòâåðäèòü ïîëüçîâàòåëåé\"></form></td></tr>");
}
print("</table><br>");
$rul = sql_query("SELECT COUNT(*) FROM invites WHERE inviter = $id") or sqlerr(__FILE__,__LINE__);
$arre = mysql_fetch_row($rul);
$number1 = $arre[0];
$rer = sql_query("SELECT inviteid, invite, time_invited FROM invites WHERE inviter = $id AND confirmed='no'") or sqlerr(__FILE__,__LINE__);
$num1 = mysql_num_rows($rer);
print("<table border=1 width=100% cellspacing=0 cellpadding=5>".
"<tr class=tabletitle><td colspan=6><b>Ñòàòóñ ñîçäàíûõ ïðèãëàøåíèé</b> ($number1)</td></tr>");
if(!$num1) {
print("<tr class=tableb><td colspan=6>Íà äàííûé ìîìåíò âàìè íå ñîçäàíî íèîäíîãî ïðèãëàøåíèÿ.</tr>");
} else {
print("<tr class=tableb><td><b>Êîä ïðèãëàøåíèÿ</b></td><td><b>Äàòà ñîçäàíèÿ</b></td><td></td></tr>");
for ($i = 0; $i < $num1; ++$i) {
$arr1 = mysql_fetch_assoc($rer);
print("<tr class=tableb><td>$arr1[invite]</td><td>$arr1[time_invited]</td>");
print ("<td><a href=\"invite.php?invite=$arr1[invite]&type=del\">Óäàëèòü ïðèãëàøåíèå</a></td></tr>");
}
}
print("<tr class=tableb><td colspan=7 align=center><form method=get action=invite.php?id=$id&type=new><input type='hidden' name='id' value='$id' /><input type='hidden' name='type' value='new' /><input type=submit value=\"Ñîçäàòü ïðèãëàøåíèå\"></form></td></tr>");
print("</table>");
}
stdfoot();
?>