-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse.php
301 lines (269 loc) · 12.9 KB
/
browse.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
require_once("include/secrets.php");
global $mysql_host, $mysql_user, $mysql_pass, $mysql_db;
$con_link = mysqli_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
dbconn(false);
loggedinorreturn();
//set_max_torrents($CURUSER['id']);
$cats = genrelist();
$fff = @$_GET['search'];
$searchstr = unesc($fff);
$cleansearchstr = searchfield($searchstr);
if (empty($cleansearchstr))
unset($cleansearchstr);
$orderby = "ORDER BY torrents.id DESC";
$addparam = "";
$wherea = array();
$wherecatina = array();
if (@$_GET["incldead"] == 1)
{
$addparam .= "incldead=1&";
if (!isset($CURUSER) || get_user_class() < UC_ADMINISTRATOR)
$wherea[] = "banned != 'yes'";
}
elseif (@$_GET["incldead"] == 2)
{
$addparam .= "incldead=2&";
$wherea[] = "visible = 'no'";
}
else
$wherea[] = "visible = 'yes'";
$category = @$_GET["cat"];
$all = @$_GET["all"];
if (!$all)
if (!$_GET && $CURUSER["notifs"])
{
$all = True;
foreach ($cats as $cat)
{
$all &= $cat['id'];
if (strpos($CURUSER["notifs"], "[cat" . $cat['id'] . "]") !== False)
{
$wherecatina[] = $cat['id'];
$addparam .= "c$cat[id]=1&";
}
}
}
elseif ($category)
{
if (!is_valid_id($category))
site_error_message("Foutmelding", "Foutieve groep ID.");
$wherecatina[] = $category;
$addparam .= "cat=$category&";
}
else
{
$all = True;
foreach ($cats as $cat)
{
$all &= @$_GET["c$cat[id]"];
if (@$_GET["c$cat[id]"])
{
$wherecatina[] = $cat['id'];
$addparam .= "c$cat[id]=1&";
}
}
}
if ($all)
{
$wherecatina = array();
$addparam = "";
}
if (count($wherecatina) > 1)
$wherecatin = implode(",",$wherecatina);
elseif (count($wherecatina) == 1)
$wherea[] = "category = $wherecatina[0]";
$wherebase = $wherea;
if (isset($cleansearchstr))
{
$wherea[] = "MATCH (search_text, ori_descr) AGAINST (" . sqlesc($searchstr) . ")";
$addparam .= "search=" . urlencode($searchstr) . "&";
$orderby = "";
}
$where = implode(" AND ", $wherea);
if (@$wherecatin)
$where .= ($where ? " AND " : "") . "category IN(" . $wherecatin . ")";
if ($where != "")
$where = "WHERE $where";
$res = mysqli_query($con_link, "SELECT COUNT(*) FROM torrents $where") or die(mysqli_error());
$row = mysqli_fetch_array($res);
$count = $row[0];
if (!$count && isset($cleansearchstr)) {
$wherea = $wherebase;
$orderby = "ORDER BY id DESC";
$searcha = explode(" ", $cleansearchstr);
$sc = 0;
foreach ($searcha as $searchss) {
if (strlen($searchss) <= 1)
continue;
$sc++;
if ($sc > 5)
break;
$ssa = array();
foreach (array("search_text", "ori_descr") as $sss)
$ssa[] = "$sss LIKE '%" . sqlwildcardesc($searchss) . "%'";
$wherea[] = "(" . implode(" OR ", $ssa) . ")";
}
if ($sc) {
$where = implode(" AND ", $wherea);
if ($where != "")
$where = "WHERE $where";
$res = mysqli_query($con_link, "SELECT COUNT(*) FROM torrents $where");
$row = mysqli_fetch_array($res);
$count = $row[0];
}
}
$torrents_per_pagina = 50;
if ($count)
{
list($pagertop, $pagerbottom, $limit) = pager($torrents_per_pagina, $count, "meest_gedownload.php?" . $addparam);
$query = "SELECT torrents.id, IF(torrents.numratings < $minvotes, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.category, torrents.leechers, torrents.seeders, torrents.name, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.numfiles,torrents.filename,torrents.owner,IF(torrents.nfo <> '', 1, 0) as nfoav," .
"categories.name AS cat_name, categories.image AS cat_pic, users.username FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where $orderby $limit";
$res = mysqli_query($con_link, $query) or die(mysqli_error());
}
else
unset($res);
site_header("Torrents");
?>
<?php
page_start(100);tabel_start();
tabel_top ("Laatste 40 torrents");
//Start of Last X torrents with poster mod
$query="SELECT id, name, category, cover as poster FROM torrents WHERE visible='yes' and category NOT IN ('32','39','44','45') ORDER BY added DESC LIMIT 40";
$result=mysqli_query($con_link, $query);
$num = mysqli_num_rows($result); // count rows
?>
<table width="99%" align="center" class="bottom" border="0" cellspacing="5" cellpadding="0">
<tr>
<td class="embedded">
<table width="100%" align="center" class="bottom" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="embedded">
<table background="/pic/statusbar/table_background.gif" border="0" cellpadding="5" width="100%">
<tr>
<td>
<marquee scrollAmount="10" onmouseover="stop();" onmouseout="start();" scrolldelay="0" direction="right">
<?php
$i = 40;
while ($row = mysqli_fetch_assoc($result))
{
if($row['poster'] != ""){
$id = $row['id'];
$name = $row['name'];
$poster = $row['poster'];
$category = $row['category'];
$name = str_replace('_', ' ' , $name);
$name = str_replace('.', ' ' , $name);
$name = substr($name, 0, 50);
echo "<a href=\"$BASEURL/details.php?id=$id\" title=\"$name\"><img src=".$row["poster"]." width=\"117\" height=\"170\" title=\"$name\" border=\"0\" padding-bottom=\"25px\" /></a> ";
$i++;
}
}
//End of the mod
?>
</marquee>
</br>
</br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table><?php tabel_einde(); ?><?php print "</br>"; ?><?php tabel_start(); ?>
<table background="pics/system/info_menu.gif" width="99%" border=0 cellpadding="5" cellspacing="0">
<tr>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=26>Film (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 26); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=27>Series (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 27); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=28>Kids (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 28); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=29>Apps (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 29); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=30>Windows (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 30); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=31>Ebooks (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 31); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=32>XXX (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 32); ?>)</a></td>
</tr><tr>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=33>HD Films (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 33); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=34>HD Series (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 34); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=35>HD Kids (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 35); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=36>Games (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 36); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=37>Mac (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 37); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=38>Stripboeken (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 38); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=39>HD XXX (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 39); ?>)</a></td>
</tr><tr>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=40>4K Films (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 40); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=41>4K Series (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 41); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=46>Series Kids (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 46); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=meest_gedownload.php?>Meest gedownload</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=43>Linux (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 43); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=44>XXX boeken (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 44); ?>)</a></td>
<td height=20 width=110 class=embedded><div align=center><a class=altlink_white href=browse.php?cat=45>4K XXX (<?php echo $torrents = get_row_count("torrents", "WHERE category=" . 45); ?>)</a></td>
</tr><tr>
</td></tr>
</table><?php tabel_einde(); ?><?php print "</br>"; ?><?php tabel_start(); ?>
<table width="99%" border=0 cellpadding="5" cellspacing="0" class=bottom>
<tr>
<td bgcolor="#000000"><a class=altlink_black href=browse.php?all=1><b>Alles weergeven</b></a></td>
<td bgcolor="#000000" align="right">
<table class=main border=0 cellspacing=0 cellpadding=0><tr><td bgcolor="#000000" class=embedded>
<form method="get" action=browse.php>
<font color=blue><b>Zoek opdracht:</b></font>
<input type="text" name="search" size="40" value="<?php echo htmlspecialchars($searchstr) ?>" />
in
<select name="cat">
<option value="0">(alle groepen)</option>
<?
$cats = genrelist();
$catdropdown = "";
foreach ($cats as $cat) {
$catdropdown .= "<option value=\"" . $cat["id"] . "\"";
if ($cat["id"] == @$_GET["cat"])
$catdropdown .= " selected=\"selected\"";
$catdropdown .= ">" . htmlspecialchars($cat["name"]) . "</option>\n";
}
$deadchkbox = "<input type=\"radio\" name=\"incldead\" value=\"1\"";
if ($_GET["incldead"])
$deadchkbox .= " checked=\"checked\"";
$deadchkbox .= " /><font color=blue><b> inclusief dode torrents</b></font>\n";
?>
<?php echo $catdropdown ?>
</select>
<?php echo $deadchkbox ?>
<input type="submit" value="Zoeken" />
</form>
</td></tr></table>
</td>
</tr>
</table>
</form>
<?php
//print "<center><font color=red size=2><b>LET OP: Indien u na het ontvangen direct stopt en niet blijft delen tot 1 op 1, gaat u een waarschuwing krijgen.</font></center>";
//print "<center><font color=red size=2><b>Als u wilt dat de uploaders gemotiveerd blijven, plaats dan eens een commentaar bij de torrent. En druk eens op de bedank knop.</font></center>";
if (isset($cleansearchstr))
print("<h2>Zoekresultaten voor \"" . htmlspecialchars($searchstr) . "\"</h2>\n");
tabel_einde();print "</br>";
if ($count)
{tabel_start();
print($pagertop);tabel_einde();print "</br>";
torrenttable($res);tabel_start();
print($pagerbottom);tabel_einde();
}
else
{
if (isset($cleansearchstr))
{
print("<h2>Niets gevonden!</h2>\n");
print("<p>Probeer het opnieuw met andere zoekopdracht.</p>\n");
}
else
{
print("<h2>Geen torrents</h2>\n");
print("<p>Er zijn geen torrents aanwezig hier. Sorry vriend :(</p><br>\n");
}
}
mysqli_query($con_link, "UPDATE users SET last_browse = NOW() where id=".$CURUSER['id']);
page_einde();
site_footer();
?>