This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheditconfig.php
596 lines (580 loc) · 32.5 KB
/
editconfig.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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<?php
require ("config.php");
require_once ("funcsv2.php");
//Check session
session_start();
if (!$_SESSION['admin_logged_in'])
{
//check fails
header("Location: authenticate.php?status=session");
exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Edit Config File</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="./css/style.css" type="text/css" />
</head><body>
<?php
//open up config file and display for editing
if (!isset($_POST["saveconfig"]))
{
?>
<h1>Edit Config File</h1>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" method="POST">
<input type="hidden" name="saveconfig" value="1">
<h2>This page allows you to configure the "config.php" settings. This file stores all the necessary
settings for your tracker. Please do NOT edit the "config.php" file directly,
use this admin page for any changes.</h2>
<h2><span class="notice">*</span> - required value</h2>
<table border="1" cellpadding="3">
<?php
//open up config file
$fr = fopen("config.php", "r") or die(errorMessage() . "Error: couldn't read config.php!</p>");
$temp = fgets($fr);
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Make tracker hidden: This will require a login by either the admin or upload user in order to
see the torrents available on the main statistics page. This does not mean it's a private tracker. If you
need a private tracker, there are many other trackers out there. Also, you will need to secure the "torrents"
folder with an .htaccess file for Apache or some other method. The tracker will still accept all valid
connections by clients. There is no user checking in that regard.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="hiddentracker"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Enable or disable scraping by clients. Generally it is safe to leave this on unless
you have a large number of torrents or users which can lead to increased bandwidth usage. Also, scraping
can possibily be used maliciously by abusive clients.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="scrape"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Displays custom titles on the main torrent statistics page instead of the filename. This is because the uploader script will auto-rename your uploaded filename to exactly what you specified initally or by automatically using the data from the uploaded torrent. Check this if you want the titles to be different from the filename.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="customtitle"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> Lists the number of torrents on each page on your torrent tracker list. Default is 10.</td>
<td><input type="text" name="indexpagelimitspecify" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> Lists the number of torrents on each page on the detailed statistics page. Default is 5.</td>
<td><input type="text" name="statspagelimitspecify" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> Maximum reannounce interval (in seconds) 1800 == 30 minutes</td>
<td><input type="text" name="report_interval" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> Minimum reannounce interval (also in seconds) 300 == 5 minutes</td>
<td><input type="text" name="min_interval" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> Number of peers to send in one request. Some logic will break if you set this to more than 300,
so please don't do that. 100 is the most you should set anyway.</td>
<td><input type="text" name="maxpeers" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>If set, NAT checking will be performed.
This may cause trouble with some providers, so it's
off by default.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="NAT"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Persistent MySQL connections:
Check with your webmaster to see if you're allowed to use these.
Highly recommended, especially for higher loads, but generally
not allowed unless it's a dedicated machine.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="persist"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Allow users to override ip address.
Enable this if you know people have a legit reason to use
this function. Leave disabled otherwise.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="ip_override"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>For heavily loaded trackers, uncheck this. It will stop count the number
of downloaded bytes and the speed of the torrent, but will significantly reduce
the load.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="countbytes"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Username for individual who can add torrents to tracker database.
This user is only able to create, and not delete torrents to the tracker.
For full privileges, see the admin user.</td>
<td><input type="text" name="upload_username" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Password for individual who can add torrents to tracker database.
Again, this user is only able to create, and not delete torrents to the tracker.
For full privileges, see the admin user.<br><br>
<input type="hidden" name="old_upload_password" value="<?php echo $temp;?>">
<b>Current hashed username+password: <?php echo $temp;?></b></td>
<td><input type="password" name="upload_password" size="40" value=""></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Admin username. The admin is able to go to the admin page and show detailed
information about the tracker as well as access a few other important tools.
The admin is also able to upload torrents to the database
just like the previous account.</td>
<td><input type="text" name="admin_username" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Password for admin. Again, The admin is able to go to the admin page and show detailed
information about the tracker as well as access a few other important tools.
The admin is also able to upload torrents to the database.<br><br>
<input type="hidden" name="old_admin_password" value="<?php echo $temp;?>">
<b>Current hashed username+password: <?php echo $temp;?></b></td>
<td><input type="password" name="admin_password" size="40" value=""></td></tr>
<?php
$temp = fgets($fr);
$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
?>
<tr><td>Title on index.php statistics page, if not set, defaults to "Tracker Statistics"</td>
<td><input type="text" name="title" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Database Hostname: This is the MySQL database hostname, if it is the local machine, it should
be set to localhost.</td>
<td><input type="text" name="dbhost" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Database Username: This is the user who has access to the database table. If you are unsure,
check with your system administrator.</td>
<td><input type="text" name="dbuser" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Database Password: This is the password for the user who has access to the database table.
If you are unsure, check with your system administrator.</td>
<td><input type="text" name="dbpass" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Database name: This is the name of the database. If you are unsure, check with
your system administrator.</td>
<td><input type="text" name="database" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td>Enable RSS feed:
If you do not want the RSS feed to be created for privacy reasons or do not need it disable this checkbox.</td>
<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="enablerss"<?php if ($temp == "true") echo " checked";?>></td></tr>
<?php
$temp = fgets($fr);
$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
?>
<tr><td>RSS Title: In the rss.xml file, this is the main <pre><title></pre> tag.</td>
<td><input type="text" name="rss_title" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td>RSS link to main website: In the rss.xml file, this is the main <pre><link></pre> tag.</td>
<td><input type="text" name="rss_link" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
?>
<tr><td>RSS description: In the rss.xml file, this is the main <pre><description></pre> tag.</td>
<td><input type="text" name="rss_description" size="60" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Website url that the tracker runs on, example: http://www.mywebsite.com</td>
<td><input type="text" name="website_url" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Main announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
<td><input type="text" name="announce_url0" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td>Secondary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
<td><input type="text" name="announce_url1" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td>Tertiary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
<td><input type="text" name="announce_url2" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td>Quaternary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
<td><input type="text" name="announce_url3" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td>Quinary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
<td><input type="text" name="announce_url4" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> For HTTP seeding, this is the maximum total upload rate per second in kilobytes, for example 100 would be 100 KB/s</td>
<td><input type="text" name="max_upload_rate" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+2, -2);
?>
<tr><td><span class="notice">*</span> For HTTP seeding, this is the maximum number of uploads to run at a time</td>
<td><input type="text" name="max_uploads" size="40" value="<?php echo $temp;?>"></td></tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Date format of the torrent publication date. It shows on statistics.php. If you change this setting, you will have to change it for every other existing torrent!</td>
<td>
<select name="dateformat" id="dateformat">
<option title="Mon, 4 Jan, 1999 01:15:40 PM" value="D, j M, Y h:i:s A"<?php if($temp == "D, j M, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, 4 Jan, 1999 01:15:40 PM</option>
<option title="Monday, 4 Jan, 1999 01:15:40 PM" value="l, j M, Y h:i:s A"<?php if($temp == "l, j M, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, 4 Jan, 1999 01:15:40 PM</option>
<option title="Mon, 4 January, 1999 01:15:40 PM" value="D, j F, Y h:i:s A"<?php if($temp == "D, j F, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, 4 January, 1999 01:15:40 PM</option>
<option title="Monday, 4 January, 1999 01:15:40 PM" value="l, j M, Y h:i:s A"<?php if($temp == "l, j F, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, 4 January, 1999 01:15:40 PM</option>
<option title="Mon, 4 Jan, 1999 13:15:40" value="D, j M, Y H:i:s"<?php if($temp == "D, j M, Y H:i:s") echo " selected=\"selected\"";?>>Mon, 4 Jan, 1999 13:15:40</option>
<option title="Monday, 4 Jan, 1999 13:15:40" value="l, j M, Y H:i:s"<?php if($temp == "l, j M, Y H:i:s") echo " selected=\"selected\"";?>>Monday, 4 Jan, 1999 13:15:40</option>
<option title="Mon, 4 January, 1999 13:15:40" value="D, j F, Y H:i:s"<?php if($temp == "D, j F, Y H:i:s") echo " selected=\"selected\"";?>>Mon, January 4, 1999 13:15:40</option>
<option title="Monday, 4 January, 1999 13:15:40" value="l, j F, Y H:i:s"<?php if($temp == "l, j F, Y H:i:s") echo " selected=\"selected\"";?>>Monday, 4 January, 1999 13:15:40</option>
<option title="Mon, Jan 4, 1999 01:15:40 PM" value="D, M j, Y h:i:s A"<?php if($temp == "D, M j, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, Jan 4, 1999 01:15:40 PM</option>
<option title="Monday, Jan 4, 1999 01:15:40 PM" value="l, M j, Y h:i:s A"<?php if($temp == "l, M j, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, Jan 4, 1999 01:15:40 PM</option>
<option title="Mon, January 4, 1999 01:15:40 PM" value="D, F j, Y h:i:s A"<?php if($temp == "D, F j, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, January 4, 1999 01:15:40 PM</option>
<option title="Monday, January 4, 1999 01:15:40 PM" value="l, F j, Y h:i:s A"<?php if($temp == "l, F j, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, January 4, 1999 01:15:40 PM</option>
<option title="Mon, Jan 4, 1999 13:15:40" value="D, M j, Y H:i:s"<?php if($temp == "D, M j, Y H:i:s") echo " selected=\"selected\"";?>>Mon, Jan 4, 1999 13:15:40</option>
<option title="Monday, Jan 4, 1999 13:15:40" value="l, M j, Y H:i:s"<?php if($temp == "l, M j, Y H:i:s") echo " selected=\"selected\"";?>>Monday, Jan 4, 1999 13:15:40</option>
<option title="Mon, January 4, 1999 13:15:40" value="D, F j, Y H:i:s"<?php if($temp == "D, F j, Y H:i:s") echo " selected=\"selected\"";?>>Mon, January 4, 1999 13:15:40</option>
<option title="Monday, January 4, 1999 13:15:40" value="l, F j, Y H:i:s"<?php if($temp == "l, F j, Y H:i:s") echo " selected=\"selected\"";?>>Monday, January 4, 1999 13:15:40</option>
</select>
</td>
</tr>
<?php
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<tr><td><span class="notice">*</span> Timezone that the server runs on</td>
<td>
<select name="timezone" id="timezone">
<option title="[UTC - 12] Baker Island Time" value="-1200"<?php if($temp == "-1200") echo " selected=\"selected\"";?>>[UTC - 12] Baker Island Time</option>
<option title="[UTC - 11] Niue Time, Samoa Standard Time" value="-1100"<?php if($temp == "-1100") echo " selected=\"selected\"";?>>[UTC - 11] Niue Time, Samoa Standard Time</option>
<option title="[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time" value="-1000"<?php if($temp == "-1000") echo " selected=\"selected\"";?>>[UTC - 10] Hawaii-Aleutian Standard Time, Cook Isl...</option>
<option title="[UTC - 9:30] Marquesas Islands Time" value="-0930"<?php if($temp == "-0930") echo " selected=\"selected\"";?>>[UTC - 9:30] Marquesas Islands Time</option>
<option title="[UTC - 9] Alaska Standard Time, Gambier Island Time" value="-0900"<?php if($temp == "-0900") echo " selected=\"selected\"";?>>[UTC - 9] Alaska Standard Time, Gambier Island Tim...</option>
<option title="[UTC - 8] Pacific Standard Time" value="-0800"<?php if($temp == "-0800") echo " selected=\"selected\"";?>>[UTC - 8] Pacific Standard Time</option>
<option title="[UTC - 7] Mountain Standard Time" value="-0700"<?php if($temp == "-0700") echo " selected=\"selected\"";?>>[UTC - 7] Mountain Standard Time</option>
<option title="[UTC - 6] Central Standard Time" value="-0600"<?php if($temp == "-0600") echo " selected=\"selected\"";?>>[UTC - 6] Central Standard Time</option>
<option title="[UTC - 5] Eastern Standard Time" value="-0500"<?php if($temp == "-0500") echo " selected=\"selected\"";?>>[UTC - 5] Eastern Standard Time</option>
<option title="[UTC - 4] Atlantic Standard Time" value="-0400"<?php if($temp == "-0400") echo " selected=\"selected\"";?>>[UTC - 4] Atlantic Standard Time</option>
<option title="[UTC - 3:30] Newfoundland Standard Time" value="-0330"<?php if($temp == "-0330") echo " selected=\"selected\"";?>>[UTC - 3:30] Newfoundland Standard Time</option>
<option title="[UTC - 3] Amazon Standard Time, Central Greenland Time" value="-0300"<?php if($temp == "-0300") echo " selected=\"selected\"";?>>[UTC - 3] Amazon Standard Time, Central Greenland ...</option>
<option title="[UTC - 2] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time" value="-0200"<?php if($temp == "-0200") echo " selected=\"selected\"";?>>[UTC - 2] Fernando de Noronha Time, South Georgia ...</option>
<option title="[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time" value="-0100"<?php if($temp == "-0100") echo " selected=\"selected\"";?>>[UTC - 1] Azores Standard Time, Cape Verde Time, E...</option>
<option title="[UTC] Western European Time, Greenwich Mean Time" value="+0000"<?php if($temp == "+0000") echo " selected=\"selected\"";?>>[UTC] Western European Time, Greenwich Mean Time</option>
<option title="[UTC + 1] Central European Time, West African Time" value="+0100"<?php if($temp == "+0100") echo " selected=\"selected\"";?>>[UTC + 1] Central European Time, West African Time</option>
<option title="[UTC + 2] Eastern European Time, Central African Time" value="+0200"<?php if($temp == "+0200") echo " selected=\"selected\"";?>>[UTC + 2] Eastern European Time, Central African T...</option>
<option title="[UTC + 3] Moscow Standard Time, Eastern African Time" value="+0300"<?php if($temp == "+0300") echo " selected=\"selected\"";?>>[UTC + 3] Moscow Standard Time, Eastern African Ti...</option>
<option title="[UTC + 3:30] Iran Standard Time" value="+0330"<?php if($temp == "+0330") echo " selected=\"selected\"";?>>[UTC + 3:30] Iran Standard Time</option>
<option title="[UTC + 4] Gulf Standard Time, Samara Standard Time" value="+0400"<?php if($temp == "+0400") echo " selected=\"selected\"";?>>[UTC + 4] Gulf Standard Time, Samara Standard Time</option>
<option title="[UTC + 4:30] Afghanistan Time" value="+0430"<?php if($temp == "+0430") echo " selected=\"selected\"";?>>[UTC + 4:30] Afghanistan Time</option>
<option title="[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time" value="+0500"<?php if($temp == "+0500") echo " selected=\"selected\"";?>>[UTC + 5] Pakistan Standard Time, Yekaterinburg St...</option>
<option title="[UTC + 5:30] Indian Standard Time, Sri Lanka Time" value="+0530"<?php if($temp == "+0530") echo " selected=\"selected\"";?>>[UTC + 5:30] Indian Standard Time, Sri Lanka Time</option>
<option title="[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time" value="+0600"<?php if($temp == "+0600") echo " selected=\"selected\"";?>>[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirs...</option>
<option title="[UTC + 6:30] Cocos Islands Time, Myanmar Time" value="+0630"<?php if($temp == "+0630") echo " selected=\"selected\"";?>>[UTC + 6:30] Cocos Islands Time, Myanmar Time</option>
<option title="[UTC + 7] Indochina Time, Krasnoyarsk Standard Time" value="+0700"<?php if($temp == "+0700") echo " selected=\"selected\"";?>>[UTC + 7] Indochina Time, Krasnoyarsk Standard Tim...</option>
<option title="[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time" value="+0800"<?php if($temp == "+0800") echo " selected=\"selected\"";?>>[UTC + 8] Chinese Standard Time, Australian Wester...</option>
<option title="[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time" value="+0900"<?php if($temp == "+0900") echo " selected=\"selected\"";?>>[UTC + 9] Japan Standard Time, Korea Standard Time...</option>
<option title="[UTC + 9:30] Australian Central Standard Time" value="+0930"<?php if($temp == "+0930") echo " selected=\"selected\"";?>>[UTC + 9:30] Australian Central Standard Time</option>
<option title="[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time" value="+1000"<?php if($temp == "+1000") echo " selected=\"selected\"";?>>[UTC + 10] Australian Eastern Standard Time, Vladi...</option>
<option title="[UTC + 10:30] Lord Howe Standard Time" value="+1030"<?php if($temp == "+1030") echo " selected=\"selected\"";?>>[UTC + 10:30] Lord Howe Standard Time</option>
<option title="[UTC + 11] Solomon Island Time, Magadan Standard Time" value="+1100"<?php if($temp == "+1100") echo " selected=\"selected\"";?>>[UTC + 11] Solomon Island Time, Magadan Standard T...</option>
<option title="[UTC + 11:30] Norfolk Island Time" value="+1130"<?php if($temp == "+1130") echo " selected=\"selected\"";?>>[UTC + 11:30] Norfolk Island Time</option>
<option title="[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time" value="+1200"<?php if($temp == "+1200") echo " selected=\"selected\"";?>>[UTC + 12] New Zealand Time, Fiji Time, Kamchatka ...</option>
<option title="[UTC + 13] Tonga Time, Phoenix Islands Time" value="+1300"<?php if($temp == "+1300") echo " selected=\"selected\"";?>>[UTC + 13] Tonga Time, Phoenix Islands Time</option>
<option title="[UTC + 14] Line Island Time" value="+1400"<?php if($temp == "+1400") echo " selected=\"selected\"";?>>[UTC + 14] Line Island Time</option>
</select>
</td>
</tr>
<?php
//get MySQL table prefix, store in hidden form field
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
<input type="hidden" name="prefix" value="<?php echo $temp;?>" />
<?php
fclose($fr);
?>
</table>
<input type="submit" value="Save Config">
</form>
<?php
}
if (isset($_POST["saveconfig"]))
{
//check required entries for values, if blank: error out
if ($_POST["announce_url0"] == "")
{
echo errorMessage() . "Error: The announce URL is blank.</p>";
exit();
}
if (!is_numeric($_POST["indexpagelimitspecify"]) || $_POST["indexpagelimitspecify"] == "" || $_POST["indexpagelimitspecify"] <= 0)
{
echo errorMessage() . "Error: The index page limit is not an integer, a negative number, or is blank.</p>";
exit();
}
if (!is_numeric($_POST["statspagelimitspecify"]) || $_POST["statspagelimitspecify"] == "" || $_POST["statspagelimitspecify"] <= 0)
{
echo errorMessage() . "Error: The statistics page limit is not an integer, a negative number, or is blank.</p>";
exit();
}
if (!is_numeric($_POST["report_interval"]) || $_POST["report_interval"] == "" || $_POST["report_interval"] <= 0)
{
echo errorMessage() . "Error: The maximum reannounce interval is not an integer, a negative number, or is blank.</p>";
exit();
}
if (!is_numeric($_POST["min_interval"]) || $_POST["min_interval"] == "" || $_POST["min_interval"] <= 0)
{
echo errorMessage() . "Error: The minimum reannounce interval is not an integer, a negative number, or is blank.</p>";
exit();
}
if (!is_numeric($_POST["maxpeers"]) || $_POST["maxpeers"] == "" || $_POST["maxpeers"] > 300 || $_POST["maxpeers"] <= 0)
{
echo errorMessage() . "Error: The number of peers to send in one request is not an integer, over 300, a negative number, zero, or blank.</p>";
exit();
}
if ($_POST["upload_username"] == "")
{
echo errorMessage() . "Error: The upload username is blank.</p>";
exit();
}
if ($_POST["admin_username"] == "")
{
echo errorMessage() . "Error: The admin username is blank.</p>";
exit();
}
if ($_POST["dbhost"] == "")
{
echo errorMessage() . "Error: The database hostname is blank.</p>";
exit();
}
if ($_POST["dbuser"] == "")
{
echo errorMessage() . "Error: The database username is blank.</p>";
exit();
}
if ($_POST["dbpass"] == "")
{
echo errorMessage() . "Error: The database password is blank.</p>";
exit();
}
if ($_POST["database"] == "")
{
echo errorMessage() . "Error: The database name is blank.</p>";
exit();
}
if ($_POST["rss_link"] != "" && Substr($_POST["rss_link"], 0, 7) != "http://")
{
echo errorMessage() . "Error: The RSS website URL does not start with http://</p>";
exit();
}
if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
{
echo errorMessage() . "Error: The website URL list does not start with http:// or is blank.</p>";
exit();
}
if ($_POST["announce_url0"] == "" || Substr($_POST["announce_url0"], 0, 7) != "http://")
{
echo errorMessage() . "Error: The announce URL list does not start with http:// or is blank.</p>";
exit();
}
if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
{
echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
exit();
}
if (!is_numeric($_POST["max_uploads"]) || $_POST["max_uploads"] == "" || $_POST["max_uploads"] <= 0)
{
echo errorMessage() . "Error: The maximum uploads is not an integer, a negative number, or is blank.</p>";
exit();
}
if ($_POST["dateformat"] == "")
{
echo errorMessage() . "Error: The date format is blank.</p>";
exit();
}
if ($_POST["timezone"] == "")
{
echo errorMessage() . "Error: The timezone is blank.</p>";
exit();
}
if ($_POST["upload_username"] == $_POST["admin_username"])
{
echo errorMessage() . "Error: The admin username cannot be the same as the upload username.</p>";
exit();
}
//calculate new password if needed
$_GET['php_version'] = PHP_VERSION;
if (version_compare(PHP_VERSION, '5.5.0*', '>='))
{
if ($_POST["upload_password"] != "")
{
$_POST["upload_password"] = password_hash($_POST["upload_username"].$_POST["upload_password"], PASSWORD_BCRYPT);
}
else
$_POST["upload_password"] = $_POST["old_upload_password"];
if ($_POST["admin_password"] != "")
{
$_POST["admin_password"] = password_hash($_POST["admin_username"].$_POST["admin_password"], PASSWORD_BCRYPT);
}
else
$_POST["admin_password"] = $_POST["old_admin_password"];
}
else if (version_compare(PHP_VERSION, '5.4.0*', '<='))
{
if ($_POST["upload_password"] != "")
{
$_POST["upload_password"] = crypt($_POST["upload_username"].$_POST["upload_password"]);
}
else
$_POST["upload_password"] = $_POST["old_upload_password"];
if ($_POST["admin_password"] != "")
{
$_POST["admin_password"] = crypt($_POST["admin_username"].$_POST["admin_password"]);
}
else
$_POST["admin_password"] = $_POST["old_admin_password"];
}
//check if config.php has write access
if (is_writable("config.php"))
{
//go through checkboxes and change "on" to "true"
if (isset($_POST["hiddentracker"]))
$hiddentracker = "true";
else
$hiddentracker = "false";
if (isset($_POST["enablerss"]))
$enablerss = "true";
else
$enablerss = "false";
if (isset($_POST["scrape"]))
$scrape = "true";
else
$scrape = "false";
if (isset($_POST["customtitle"]))
$customtitle = "true";
else
$customtitle = "false";
if (isset($_POST["NAT"]))
$NAT = "true";
else
$NAT = "false";
if (isset($_POST["persist"]))
$persist = "true";
else
$persist = "false";
if (isset($_POST["ip_override"]))
$ip_override = "true";
else
$ip_override = "false";
if (isset($_POST["countbytes"]))
$countbytes = "true";
else
$countbytes = "false";
//write config.php file
$fd = fopen("config.php", "w") or die(errorMessage() . "Warning: write to config.php!</p>");
fwrite($fd,
"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
"\$GLOBALS['persist'] = " . $persist . ";\n" .
"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
"\$upload_password = '" . htmlspecialchars($_POST["upload_password"]) . "';\n" .
"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
"\$admin_password = '" . htmlspecialchars($_POST["admin_password"]) . "';\n" .
"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
"\$enablerss = " . $enablerss . ";\n" .
"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
"?>"
);
fclose($fd);
echo "<br><p class=\"success\">config.php file was edited successfully!</p>\n";
//run RSS generator
require_once("rss_generator.php");
}
else
{
echo errorMessage() . "config.php was not able to be written. Please check the permissions and try again.</p>\n";
}
}
?>
<br>
<br>
<a href="admin.php"><img src="images/admin.png" border="0" class="icon" alt="Admin Page" title="Admin Page" /></a><a href="admin.php">Return to Admin Page</a>
</body>
</html>