-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.php
219 lines (190 loc) · 7.38 KB
/
report.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
<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2011-11-11 21:55:48 +0000 (Fri, 11 Nov 2011) $
// $LastChangedBy: dj-howarth1 $
//
// http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
stdhead("Report");
begin_frame("Report");
$takeuser = (int) $_POST["user"];
$taketorrent = (int) $_POST["torrent"];
$takeforumid = (int) $_POST["forumid"];
$takecomment = (int) $_POST["comment"];
$takeforumpost = (int) $_POST["forumpost"];
$takereason = $_POST["reason"];
$user = (int)$_GET["user"];
$torrent = (int)$_GET["torrent"];
$comment = (int)$_GET["comment"];
$forumid = (int)$_GET["forumid"];
$forumpost = (int)$_GET["forumpost"];
//take report user
if (!empty($takeuser)){
if (empty($takereason)){
show_error_msg(T_("ERROR"), T_("YOU_MUST_ENTER_A_REASON"), 0);
end_frame();
stdfoot();
die;
}
$res = SQL_Query_exec("SELECT id FROM reports WHERE addedby = $CURUSER[id] AND votedfor = $takeuser AND type = 'user'");
if (mysql_num_rows($res) == 0){
SQL_Query_exec("INSERT into reports (addedby,votedfor,type,reason) VALUES ($CURUSER[id],$takeuser,'user', ".sqlesc($takereason).")");
print("User: $takeuser, Reason: ".htmlspecialchars($takereason)."<p>Successfully Reported</p>");
end_frame();
stdfoot();
die();
}else{
print(T_("YOU_HAVE_ALREADY_REPORTED")." user $takeuser");
end_frame();
stdfoot();
die();
}
}
//take report torrent
if (($taketorrent !="") && ($takereason !="")){
if (!$takereason){
show_error_msg(T_("ERROR"), T_("YOU_MUST_ENTER_A_REASON"), 0);
stdfoot();
end_frame();
die;
}
$res = SQL_Query_exec("SELECT id FROM reports WHERE addedby = $CURUSER[id] AND votedfor = $taketorrent AND type = 'torrent'");
if (mysql_num_rows($res) == 0){
SQL_Query_exec("INSERT into reports (addedby,votedfor,type,reason) VALUES ($CURUSER[id],$taketorrent,'torrent', ".sqlesc($takereason).")");
print("Torrent: $taketorrent, Reason: ".htmlspecialchars($takereason)."<p>Successfully Reported</p>");
end_frame();
stdfoot();
die();
}else{
print(T_("YOU_HAVE_ALREADY_REPORTED")." torrent $taketorrent");
end_frame();
stdfoot();
die();
}
}
//take report comment
if (($takecomment !="") && ($takereason !="")){
if (!$takereason){
show_error_msg(T_("ERROR"), T_("YOU_MUST_ENTER_A_REASON"), 0);
stdfoot();
end_frame();
die;
}
$res = SQL_Query_exec("SELECT id FROM reports WHERE addedby = $CURUSER[id] AND votedfor = $takecomment AND type = 'comment'");
if (mysql_num_rows($res) == 0){
SQL_Query_exec("INSERT into reports (addedby,votedfor,type,reason) VALUES ($CURUSER[id],$takecomment,'comment', ".sqlesc($takereason).")");
print("Comment: $takecomment, Reason: ".htmlspecialchars($takereason)."<p>Successfully Reported</p>");
end_frame();
stdfoot();
die();
}else{
print(T_("YOU_HAVE_ALREADY_REPORTED")." torrent $takecomment");
end_frame();
stdfoot();
die();
}
}
//take forum post report
if (($takeforumid !="") && ($takereason !="")){
if (!$takereason){
show_error_msg(T_("ERROR"), T_("YOU_MUST_ENTER_A_REASON"), 0);
stdfoot();
end_frame();
die;
}
$res = SQL_Query_exec("SELECT id FROM reports WHERE addedby = $CURUSER[id] AND votedfor= $takeforumid AND votedfor_xtra= $takeforumpost AND type = 'forum'");
if (mysql_num_rows($res) == 0){
SQL_Query_exec("INSERT into reports (addedby,votedfor,votedfor_xtra,type,reason) VALUES ($CURUSER[id],$takeforumid,$takeforumpost ,'forum', ".sqlesc($takereason).")");
print("User: $takeuser, Reason: ".htmlspecialchars($takereason)."<p>Successfully Reported</p>");
end_frame();
stdfoot();
die();
}else{
print(T_("YOU_HAVE_ALREADY_REPORTED")." post $takeforumid");
end_frame();
stdfoot();
die();
}
}
//report user form
if ($user !=""){
$res = SQL_Query_exec("SELECT username, class FROM users WHERE id=$user");
if (mysql_num_rows($res) == 0){
print(T_("INVALID_USERID"));
end_frame();
stdfoot();
die();
}
$arr = mysql_fetch_assoc($res);
print("<b>Are you sure you would like to report user:</b><br /><a href='account-details.php?id=$user'><b>$arr[username]</b></a>?<br />");
print("<p>Please note, this is <b>not</b> to be used to report leechers, we have scripts in place to deal with them</p>");
print("<b>Reason</b> (required): <form method='post' action='report.php'><input type='hidden' name='user' value='$user' /><input type='text' size='100' name='reason' /><input type='submit' value='Confirm' /></form>");
end_frame();
stdfoot();
die();
}
//report torrent form
if ($torrent !=""){
$res = SQL_Query_exec("SELECT name FROM torrents WHERE id=$torrent");
if (mysql_num_rows($res) == 0){
print("Invalid TorrentID");
end_frame();
stdfoot();
die();
}
$arr = mysql_fetch_array($res);
print("<b>Are you sure you would like to report torrent:</b><br /><a href='torrents-details.php?id=$torrent'><b>$arr[name]</b></a>?<br />");
print("<b>Reason</b> (required): <form method='post' action='report.php'><input type='hidden' name='torrent' value='$torrent' /><input type='text' size='100' name='reason' /><input type='submit' value='Confirm' /></form>");
end_frame();
stdfoot();
die();
}
//report forum post form
if (($forumid !="") && ($forumpost !="")){
$res = SQL_Query_exec("SELECT subject FROM forum_topics WHERE id=$forumid");
if (mysql_num_rows($res) == 0){
print("Invalid Forum ID");
end_frame();
stdfoot();
die();
}
$arr = mysql_fetch_array($res);
print("<b>Are you sure you would like to report the following forum post:</b><br /><a href='forums.php?action=viewtopic&topicid=$forumid&page=p#post$forumpost'><b>$arr[subject]</b></a>?<br />");
print("<b>Reason</b> (required): <form method='post' action='report.php'><input type='hidden' name='forumid' value='$forumid' /><input type='hidden' name='forumpost' value='$forumpost'><input type='text' size='100' name='reason' /><input type='submit' value='Confirm' /></form>");
end_frame();
stdfoot();
die;
}
//report comment form
if ($comment !=""){
$res = SQL_Query_exec("SELECT id, text FROM comments WHERE id=$comment");
if (mysql_num_rows($res) == 0){
print("Invalid Comment");
end_frame();
stdfoot();
die();
}
$arr = mysql_fetch_assoc($res);
print("<b>Are you sure you would like to report Comment:</b><br /><br /><b>".format_comment($arr["text"])."</b>?<br />");
print("<p>Please note, this is <b>not</b> to be used to report leechers, we have scripts in place to deal with them</p>");
print("<b>Reason</b> (required): <form method='post' action='report.php'><input type='hidden' name='comment' value='$comment' /><input type='text' size='100' name='reason' /><input type='submit' value='Confirm' /></form>");
end_frame();
stdfoot();
die();
}
//error
if (($user !="") && ($torrent !="")){
print("<h1>".T_("MISSING_INFO")."</h1>");
end_frame();
stdfoot();
die();
}
show_error_msg(T_("ERROR"), T_("MISSING_INFO").".", 0);
end_frame();
stdfoot();
?>