-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodtask.php
231 lines (208 loc) · 9.63 KB
/
modtask.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
require "include/bittorrent.php";
loggedinorreturn();
iplogger();
if (get_user_class() < UC_MODERATOR)
puke();
$action = $_POST["action"];
if ($action == "confirmuser")
{
$userid = $_POST["userid"];
$confirm = $_POST["confirm"];
mysql_query('UPDATE `users` SET `status` = \''.mysql_real_escape_string($confirm).'\', `info` = NULL WHERE `id` = '.mysql_real_escape_string($userid).' LIMIT 1;') or sqlerr(__FILE__, __LINE__);
header("Location: $BASEURL/admin/unco.php?status=1");
die;
}
if ($action == "edituser")
{
$warned = $_POST["warned"];
$warnlength = 0 + $_POST["warnlength"];
$warnpm = $_POST["warnpm"];
$userid = $_POST["userid"];
$title = $_POST["title"];
$avatar = $_POST["avatar"];
$signature = $_POST["signature"];
$enabled = $_POST["enabled"];
$uploadpos = $_POST["uploadpos"];
$downloadpos = $_POST["downloadpos"];
$downloaded = $_POST["downloaded"];
$uploaded = $_POST["uploaded"];
$privacy = $_POST["privacy"];
$forumpost = $_POST["forumpost"];
$email = $_POST["email"];
$username = $_POST["username"];
$chpassword = $_POST["chpassword"];
$passagain = $_POST["passagain"];
if ($chpassword != "" AND $passagain != "") {
unset($passupdate);
$passupdate=false;
if ($chpassword == $username OR strlen($chpassword) > 40 OR strlen($chpassword) < 6 OR $chpassword != $passagain)
$passupdate=false;
else
$passupdate=true;
}
if ($passupdate) {
$sec = mksecret();
$passhash = md5($sec . $chpassword . $sec);
$updateset[] = "secret = " . sqlesc($sec);
$updateset[] = "passhash = " . sqlesc($passhash);
}
$donor = $_POST["donor"];
$donated = $_POST["donated"];
$modcomment = $_POST["modcomment"];
$support = $_POST["support"];
$supportlang = $_POST["supportlang"];
$supportfor = $_POST["supportfor"];
$class = 0 + $_POST["class"];
if (!is_valid_id($userid) || !is_valid_user_class($class))
stderr("Error", "Bad user ID or class ID.");
$res = mysql_query("SELECT * FROM users WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$arr = mysql_fetch_assoc($res) or puke();
$res2 = mysql_query("SELECT class FROM users WHERE id = ".sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$arr2 = mysql_fetch_assoc($res2) or puke();
$res3 = mysql_query("SELECT minclasstoedit FROM usergroups WHERE id = ".sqlesc($arr2['class'])) or sqlerr(__FILE__, __LINE__);
$minclasstoedit = mysql_fetch_assoc($res3) or puke();
$curenabled = $arr["enabled"];
$curparked = $arr["parked"];
$curuploadpos = $arr["uploadpos"];
$curdownloadpos = $arr["downloadpos"];
$curforumpost = $arr["forumpost"];
if ($donated != $arr[donated]) {
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO funds (cash, user, added) VALUES ($donated, $userid, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "donated = " . sqlesc($donated);
$updateset[] = "total_donated = $arr[total_donated] + " . sqlesc($donated);
}
$curclass = $arr["class"];
$curwarned = $arr["warned"];
if ($curclass != $class)
{
$what = ($class > $curclass ? "promoted" : "demoted");
$msg = sqlesc("You have been $what to '" . get_user_class_name($class) . "' by $CURUSER[username].");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES(0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "class = $class";
$what = ($class > $curclass ? "Promoted" : "Demoted");
$modcomment = gmdate("Y-m-d") . " - $what to '" . get_user_class_name($class) . "' by $CURUSER[username].\n". $modcomment;
}
if ($warned && $curwarned != $warned)
{
$updateset[] = "warned = " . sqlesc($warned);
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
if ($warned == 'no')
{
$modcomment = gmdate("Y-m-d") . " - Warning removed by $CURUSER[username].\n". $modcomment;
$msg = sqlesc("Your warning have been removed by" . $CURUSER['username'] . ".");
}
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
elseif ($warnlength)
{
if ($warnlength == 255)
{
$modcomment = gmdate("Y-m-d") . " - Warned by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment;
$msg = sqlesc("You have been [url=rules.php#warning]warned[/url] by $CURUSER[username]." . ($warnpm ? "\n\nReason: $warnpm" : ""));
$updateset[] = "warneduntil = '0000-00-00 00:00:00'";
}else{
$warneduntil = get_date_time(gmtime() + $warnlength * 604800);
$dur = $warnlength . " week" . ($warnlength > 1 ? "s" : "");
$msg = sqlesc("You have been [url=rules.php#warning]warned[/url] for $dur by " . $CURUSER['username'] . "." . ($warnpm ? "\n\nReason: $warnpm" : ""));
$modcomment = gmdate("Y-m-d") . " - Warned for $dur by " . $CURUSER['username'] . ".\nReason: $warnpm.\n". $modcomment;
$updateset[] = "warneduntil = '$warneduntil'";
}
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
$updateset[] = "warned = 'yes', timeswarned = timeswarned+1, lastwarned=$added, warnedby=$CURUSER[id]";
}
if ($enabled != $curenabled)
{
if ($enabled == 'yes') {
$nowdate = sqlesc(get_date_time());
$modcomment = gmdate("Y-m-d") . " - Enabled by " . $CURUSER['username']. ".\n". $modcomment;
mysql_query("UPDATE users SET downloaded='100', uploaded='100,' last_access=$nowdate WHERE id = ".sqlesc($userid));
} else {
$modcomment = gmdate("Y-m-d") . " - Disabled by " . $CURUSER['username']. ".\n". $modcomment;
}
}
if ($privacy == "low" OR $privacy == "normal" OR $privacy == "strong")
$updateset[] = "privacy = " . sqlesc($privacy);
if ($_POST["resetkey"] == "yes")
{
$newpasskey = md5($arr['username'].get_date_time().$arr['passhash']);
$updateset[] = "passkey = ".sqlesc($newpasskey);
}
if ($forumpost != $curforumpost)
{
if ($forumpost == 'yes')
{
$modcomment = gmdate("Y-m-d") . " - Posting enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your Posting rights have been given back by " . $CURUSER['username'] . ". You can post to forum again.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = gmdate("Y-m-d") . " - Posting disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your Posting rights have been removed by " . $CURUSER['username'] . ", propably because of bad Atitdue or description.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
if ($uploadpos != $curuploadpos)
{
if ($uploadpos == 'yes')
{
$modcomment = gmdate("Y-m-d") . " - Upload enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your upload rights have been given back by " . $CURUSER['username'] . ". You can upload torrents again.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = gmdate("Y-m-d") . " - Upload disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your upload rights have been removed by " . $CURUSER['username'] . ", propably because of bad torrent .nfo or description.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
if ($downloadpos != $curdownloadpos)
{
if ($downloadpos == 'yes')
{
$modcomment = gmdate("Y-m-d") . " - Download enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your download rights have been given back by " . $CURUSER['username'] . ". You can download torrents again.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
else
{
$modcomment = gmdate("Y-m-d") . " - Download disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
$msg = sqlesc("Your download rights have been removed by " . $CURUSER['username'] . ", propably because of bad torrent .nfo or description.");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
}
}
$updateset[] = "enabled = " . sqlesc($enabled);
$updateset[] = "uploadpos = " . sqlesc($uploadpos);
$updateset[] = "downloadpos = " . sqlesc($downloadpos);
$updateset[] = "downloaded = " . sqlesc($downloaded);
$updateset[] = "uploaded = " . sqlesc($uploaded);
$updateset[] = "forumpost = " . sqlesc($forumpost);
$updateset[] = "email = " . sqlesc($email);
$updateset[] = "username = " . sqlesc($username);
$updateset[] = "donor = " . sqlesc($donor);
$updateset[] = "avatar = " . sqlesc($avatar);
$updateset[] = "signature = " . sqlesc($signature);
$updateset[] = "title = " . sqlesc($title);
$updateset[] = "modcomment = " . sqlesc($modcomment);
$updateset[] = "support = " . sqlesc($support);
$updateset[] = "supportfor = " . sqlesc($supportfor);
$updateset[] = "supportlang = ".sqlesc($supportlang);
mysql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE id=$userid") or sqlerr(__FILE__, __LINE__);
$returnto = htmlentities($_POST["returnto"]);
header("Location: $BASEURL/$returnto");
die;
}
puke();
?>