-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
393 lines (337 loc) · 11.9 KB
/
index.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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<?
//# -*- coding: iso-8859-1 -*-
// WARNING DON'T EDIT AND SAVE THIS FILE USING utf-8 CHARSET BECAUSE IT WILL BE CORRUPTED
// THIS FILE HAVE HAVE TO BE EDITED AND SAVED IN CHARSET ISO-8859-1
define ( 'IN_DMC', 1 );
//Uncomment to put offline
//echo "sorry the server is down";
//exit;
function mkp_input() {
global $HTTP_GET_VARS, $HTTP_POST_VARS;
if (!isset($HTTP_POST_VARS) && isset($_POST))
{
$HTTP_POST_VARS = $_POST;
$HTTP_GET_VARS = $_GET;
}
$result = array();
if(is_array($HTTP_GET_VARS)) {
while(list($k, $v) = each($HTTP_GET_VARS)) {
if(is_array($HTTP_GET_VARS[$k])) {
while( list($k2, $v2) = each($HTTP_GET_VARS[$k])) {
$k2 = preg_replace( "/\.\./" , "" , $k2 );
$k2 = preg_replace( "/\_\_(.+?)\_\_/" , "" , $k2 );
$k2 = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $k2 );
$v2 = str_replace( "&" , "&" , $v2 );
$v2 = str_replace( "<!--" , "<!--" , $v2 );
$v2 = str_replace( "-->" , "-->" , $v2 );
$v2 = preg_replace( "/<script/i" , "<script" , $v2 );
$v2 = str_replace( ">" , ">" , $v2 );
$v2 = str_replace( "<" , "<" , $v2 );
$v2 = str_replace( "\"" , """ , $v2 );
$v2 = preg_replace( "/\n/" , "<br />" , $v2 );
$v2 = preg_replace( "/\\\$/" , "$" , $v2 );
$v2 = preg_replace( "/\r/" , "" , $v2 );
//$v2 = str_replace( "!" , "!" , $v2 );
$v2 = str_replace( "'" , "'" , $v2 );
$result[$k][$k2] = $v2;
}
} else {
$v = str_replace( "&" , "&" , $v );
$v = str_replace( "<!--" , "<!--" , $v );
$v = str_replace( "-->" , "-->" , $v );
$v = preg_replace( "/<script/i" , "<script" , $v );
$v = str_replace( ">" , ">" , $v );
$v = str_replace( "<" , "<" , $v );
$v = str_replace( "\"" , """ , $v );
$v = preg_replace( "/\n/" , "<br />" , $v );
$v = preg_replace( "/\\\$/" , "$" , $v );
$v = preg_replace( "/\r/" , "" , $v );
//$v = str_replace( "!" , "!" , $v );
$v = str_replace( "'" , "'" , $v );
$result[$k] = $v;
}
}
}
if( is_array($HTTP_POST_VARS)) {
while(list($k, $v) = each($HTTP_POST_VARS)) {
if (is_array($HTTP_POST_VARS[$k]) ) {
while(list($k2, $v2) = each($HTTP_POST_VARS[$k])) {
$k2 = preg_replace( "/\.\./" , "" , $k2 );
$k2 = preg_replace( "/\_\_(.+?)\_\_/" , "" , $k2 );
$k2 = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $k2 );
$v2 = str_replace( "&" , "&" , $v2 );
$v2 = str_replace( "<!--" , "<!--" , $v2 );
$v2 = str_replace( "-->" , "-->" , $v2 );
$v2 = preg_replace( "/<script/i" , "<script" , $v2 );
$v2 = str_replace( ">" , ">" , $v2 );
$v2 = str_replace( "<" , "<" , $v2 );
$v2 = str_replace( "\"" , """ , $v2 );
$v2 = preg_replace( "/\n/" , "<br />" , $v2 );
$v2 = preg_replace( "/\\\$/" , "$" , $v2 );
$v2 = preg_replace( "/\r/" , "" , $v2 );
//$v2 = str_replace( "!" , "!" , $v2 );
$v2 = str_replace( "'" , "'" , $v2 );
$result[$k][$k2] = $v2;
}
} else {
$v = str_replace( "&" , "&" , $v );
$v = str_replace( "<!--" , "<!--" , $v );
$v = str_replace( "-->" , "-->" , $v );
$v = preg_replace( "/<script/i" , "<script" , $v );
$v = str_replace( ">" , ">" , $v );
$v = str_replace( "<" , "<" , $v );
$v = str_replace( "\"" , """ , $v );
$v = preg_replace( "/\n/" , "<br />" , $v );
$v = preg_replace( "/\\\$/" , "$" , $v );
$v = preg_replace( "/\r/" , "" , $v );
//$v = str_replace( "!" , "!" , $v );
$v = str_replace( "'" , "'" , $v );
$result[$k] = $v;
}
}
}
return $result;
}
function prepareoutput($t) {
$t = str_replace( "&", "&", $t);
$t = str_replace( "ä", "ä", $t);
$t = str_replace( "ö", "ö", $t);
$t = str_replace( "ü", "ü", $t);
$t = str_replace( "Ä", "Ä", $t);
$t = str_replace( "Ö", "Ö", $t);
$t = str_replace( "Ü", "Ü", $t);
$t = str_replace( "ß", "ß", $t);
$t = str_replace( "à", "à", $t);
$t = str_replace( "è", "è", $t);
$t = str_replace( "é", "é", $t);
$t = str_replace( "ì", "ì", $t);
$t = str_replace( "ò", "ò", $t);
$t = str_replace( "ù", "ù", $t);
return $t;
}
function data_conn() {
global $DB, $config;
$config = array();
$to_require = "./mk_mySQL.php";
require ($to_require);
$DB = new db_driver;
$DB->connect();
$query = $DB->query("SELECT * FROM dream_stats");
while( $row = $DB->fetch_row($query) ) {
$chiave = $row['chiave'];
$valore = $row['valore'];
$config[$chiave] = $valore;
}
$totalconn = ++$config['totalconn'];
$todayconn = ++$config['todayconn'];
$timenow = time();
$curtime1 = gmdate("M d",$config['lastconn']);
$curtime2 = gmdate("M d", $timenow);
if ($curtime1 != $curtime2) {
$todayconn = 1;
}
$DB->query("UPDATE dream_stats SET valore ='$totalconn' where chiave = 'totalconn'");
$DB->query("UPDATE dream_stats SET valore ='$todayconn' where chiave = 'todayconn'");
$DB->query("UPDATE dream_stats SET valore ='$timenow' where chiave = 'lastconn'");
}
function err_show() {
echo "Error: This page is not available";
}
function stats_show2() {
global $DB, $mkportals, $config;
$useragent = $_SERVER['HTTP_USER_AGENT'];
data_conn();
$team = $mkportals['t'];
$totalconn = $config['totalconn'];
$todayconn = $config['todayconn'];
$content = "$totalconn \n";
$content .= "$todayconn \n";
// $query = $DB->query("SELECT id FROM dream_news ORDER BY `id` DESC LIMIT 1");
// $row = $DB->fetch_row($query);
// $id = $row['id'];
$content .= "Disabled \n";
$query = $DB->query("SELECT id FROM dream_files ORDER BY `id` DESC LIMIT 1");
$row = $DB->fetch_row($query);
$id = $row['id'];
$content .= "$id \n";
// $query = $DB->query("SELECT id FROM dream_shout ORDER BY `id` DESC LIMIT 1");
// $row = $DB->fetch_row($query);
// $id = $row['id'];
$content .= "Disabled \n";
$query = $DB->query( "SELECT id, title, view FROM dream_news ORDER BY `view` DESC LIMIT 1");
$row = $DB->fetch_row($query);
$title = $row['title'];
$view = $row['view'];
$content .= "$title \n";
$content .= "$view \n";
$query = $DB->query( "SELECT id, title, downloads FROM dream_files ORDER BY `downloads` DESC LIMIT 1");
$row = $DB->fetch_row($query);
$title = $row['title'];
$downloads = $row['downloads'];
$content .= "$title \n";
$content .= "$downloads \n";
$DB->close_db();
echo $content;
exit;
}
function category_show() {
global $DB, $mkportals;
$cat = $mkportals['cat'];
$check = 0;
switch($cat) {
case 'Plugins':
$check = 1;
break;
case 'Plugins2':
$check = 1;
break;
case 'Skins':
$check = 1;
break;
case 'Scripts':
$check = 1;
break;
case 'Logos':
$check = 1;
break;
case 'Settings':
$check = 1;
break;
case 'Picons':
$check = 1;
break;
case 'Dreambox-Skins':
$check = 1;
break;
default:
$check = 0;
break;
}
if ($check == 0) {
echo "Buuuuuu !!!";
exit;
}
$useragent = $_SERVER['HTTP_USER_AGENT'];
data_conn();
$content = "";
$query = $DB->query( "SELECT id, title FROM dream_files WHERE categoria='$cat' ORDER BY `title`");
while( $row = $DB->fetch_row($query) ) {
$id = $row['id'];
$title = stripslashes($row['title']);
$title = prepareoutput($title);
$content.= $id."\n";
$content.= $title."\n";
}
$DB->close_db();
echo $content;
exit;
}
function category_latestE2() {
global $DB, $mkportals;
$useragent = $_SERVER['HTTP_USER_AGENT'];
data_conn();
$good="'Plugins', 'Plugins', 'Skins', 'Scripts', 'Logos', 'Settings', 'Picons'";
$content = "";
$query = $DB->query( "SELECT id, title
FROM (dream_files)
WHERE categoria IN ($good)
ORDER BY `id` DESC LIMIT 10");
while( $row = $DB->fetch_row($query) ) {
$id = $row['id'];
$title = stripslashes($row['title']);
$title = prepareoutput($title);
$content.= $id."\n";
$content.= $title."\n";
}
$DB->close_db();
echo $content;
exit;
}
function category_latestE3() {
global $DB, $mkportals;
$useragent = $_SERVER['HTTP_USER_AGENT'];
data_conn();
$good="'Plugins', 'Plugins2', 'Skins', 'Scripts', 'Logos', 'Settings', 'Picons'";
$content = "";
$query = $DB->query( "SELECT id, title
FROM (dream_files)
WHERE categoria IN ($good)
ORDER BY `id` DESC LIMIT 10");
while( $row = $DB->fetch_row($query) ) {
$id = $row['id'];
$title = stripslashes($row['title']);
$title = prepareoutput($title);
$content.= $id."\n";
$content.= $title."\n";
}
$DB->close_db();
echo $content;
exit;
}
function file_show() {
global $DB, $mkportals;
$useragent = $_SERVER['HTTP_USER_AGENT'];
$id = $mkportals['idf'];
$id = ($id = intval($id)) < 0 ? 0 : $id;
if (!$id) {
echo "Buuuuuu !!!";
}
data_conn();
$content = "";
$query = $DB->query( "SELECT id, title, categoria, author, description, file, downloads, peso, data FROM dream_files WHERE id='$id'");
$row = $DB->fetch_row($query);
$id = $row['id'];
$title = stripslashes($row['title']);
$title = prepareoutput($title);
$autore = stripslashes($row['author']);
$autore = prepareoutput($autore);
$message = stripslashes($row['description']);
$message = prepareoutput($message);
$filename = stripslashes($row['file']);
$peso = round(($row['peso']/1024),2)." Kb";
$curtime = gmdate("M d H:i", $row['data']);
$timenow = time();
$curtime1 = gmdate("M d", $row['data']);
$curtime2 = gmdate("M d", $timenow);
if ($curtime1 == $curtime2) {
$curtime = "Today ";
$curtime .= gmdate("H:i", $row['data']);
}
$categoria = stripslashes($row['categoria']);
$view = $row['downloads'];
++$view;
$content.= "$filename\n";
$content.= "$title\n";
$content.= "$autore\n";
$content.= "$curtime\n";
$content.= "$peso\n";
$content.= "$view\n";
$content.= "$categoria\n";
$content.= "$message\n";
$DB->query("UPDATE dream_files SET downloads ='$view' WHERE id='$id'");
$DB->close_db();
echo $content;
exit;
}
$mkportals = mkp_input();
switch($mkportals['op']) {
case 'outmestats2':
stats_show2();
break;
case 'outcat':
category_show();
break;
case 'outcat10_2':
category_latestE2();
break;
case 'outcat10_3':
category_latestE3();
break;
case 'outfile':
file_show();
break;
default:
err_show();
break;
}
?>