Browse code

Checks added to some files: torrent_functions.php, tracker.php dltorrent.php's check changed to authenticate no matter what Some fixes and modifications from 2014: index.php, funcsv2.php, batch_upload.php, newtorrents.php, install.php, editconfig.php Version bumped up to 1.05

Clarissa Walker authored on 2015/08/30 00:06:28
Showing 10 changed files
... ...
@@ -56,7 +56,7 @@ if (isset($_FILES["zipfile"]) && $_FILES["zipfile"]["error"] != 4 && isset($_FIL
56 56
 					require_once ("BDecode.php");
57 57
 					require_once ("BEncode.php");
58 58
 					
59
-					$tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -16) . $announceurl;
59
+					$tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
60 60
 					
61 61
 					$array = BDecode($buffer);
62 62
 					if (!$array)
... ...
@@ -75,15 +75,16 @@ if (isset($_FILES["zipfile"]) && $_FILES["zipfile"]["error"] != 4 && isset($_FIL
75 75
 						}
76 76
 						if ($found_tracker == false)
77 77
 						{
78
-							echo errorMessage() . "Error: Multiple trackers were found but none of them match the
79
-								announce URL:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
78
+							echo errorMessage() . "Error: Multiple trackers were found but none of them match the primary
79
+								announce URL:<br>$tracker_url<br><br>or any alternate URLs:<br>$announce_url1<br>$announce_url2<br>$announce_url3<br>$announce_url4<br><br>Please re-create and re-upload the torrent.</p>\n";
80 80
 							$error_status = false;
81 81
 							exit;
82 82
 						}
83 83
 					} else {
84 84
 						//a single tracker is listed
85 85
 						if (strtolower($array["announce"]) != $tracker_url) {
86
-							echo errorMessage() . "Error: The tracker announce URL does not match this:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
86
+							echo errorMessage() . "Error: The tracker announce URL does not match the primary
87
+								announce URL:<br>$tracker_url<br><br>or any alternate URLs:<br>$announce_url1<br>$announce_url2<br>$announce_url3<br>$announce_url4<br><br>Please re-create and re-upload the torrent.</p>\n";
87 88
 							$error_status = false;
88 89
 							exit;
89 90
 						}
... ...
@@ -176,7 +177,7 @@ else
176 177
 {
177 178
 	//display upload box
178 179
 	?>
179
-	<?php require("config.php"); $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -16) . $announceurl; ?>
180
+	<?php require("config.php"); $tracker_url = $announce_url0; $alt_tracker_url1 = $announce_url1;	$alt_tracker_url2 = $announce_url2;	$alt_tracker_url3 = $announce_url3;	$alt_tracker_url4 = $announce_url4;?>
180 181
 	<p>This page lets you upload a zip file containing multiple torrents and add them into the database.  The
181 182
 	zip file cannot have any folders in it.  This requires that you are running PHP with compiled zip support.
182 183
 	If you are unsure, check with your system administrator or phpinfo().  Any torrents that already exist in
... ...
@@ -189,7 +190,8 @@ else
189 190
 	[1] Even if the custom title option is enabled, the torrents will have the same title as the filename.  If you
190 191
 	have the custom title option enabled, you may change the titles to your preference after the batch upload has
191 192
 	finished.<br>[2] The torrents you are batch uploading should include the following Tracker URL:
192
-	<b><?php echo $tracker_url ?></b></p>
193
+	<br><b><?php echo $tracker_url ?></b><br> or its alternate tracker URLs: <br><b><?php echo $alt_tracker_url1;?> <br>
194
+	<?php echo $alt_tracker_url2;?> <br> <?php echo $alt_tracker_url3;?> <br> <?php echo $alt_tracker_url4; ?></b></p>
193 195
 	
194 196
 	<?php
195 197
 	if (function_exists("zip_open"))
... ...
@@ -2,21 +2,12 @@
2 2
 
3 3
 require_once ("config.php");
4 4
 
5
-//Check session only if hiddentracker is TRUE
6
-if ($hiddentracker == true)
7
-{
8
-	session_start();
9
-	
10
-	if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
11
-	{
12
-		//check fails
13
-		header("Location: authenticate.php?status=error");
14
-		exit();
15
-	}
16
-}
17
-else
5
+session_start();
6
+
7
+if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
18 8
 {
19
-	//don't run
9
+	//check fails
10
+	header("Location: authenticate.php?status=session");
20 11
 	exit();
21 12
 }
22 13
 
... ...
@@ -60,17 +60,6 @@ if (!isset($_POST["saveconfig"]))
60 60
 	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="customtitle"<?php if ($temp == "true") echo " checked";?>></td></tr>
61 61
 	<?php
62 62
 	$temp = fgets($fr);
63
-	$temp = substr($temp, strpos($temp, "=")+3, -3);
64
-	?>
65
-	<tr><td>Short Announce URL: You can turn on the short announce feature, making the URL end in /announce for your tracker. You should not utilize both tracker URL forms in one torrent at the same time, or you will get inconsistent results. Note: You will need the provided htaccess file, have URL rewrite capabilities, and have it properly set up to use this feature. Otherwise, leave it disabled.</td>
66
-	<td><select name="announceurl" id="announceurl">
67
-	<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
68
-	<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
69
-	</select>
70
-	</td>
71
-	</tr>
72
-	<?php
73
-	$temp = fgets($fr);
74 63
 	$temp = substr($temp, strpos($temp, "=")+2, -2);
75 64
 	?>
76 65
 	<tr><td><span class="notice">*</span> Lists the number of torrents on each page on your torrent tracker list. Default is 10.</td>
... ...
@@ -233,10 +222,40 @@ if (!isset($_POST["saveconfig"]))
233 222
 	$temp = fgets($fr);
234 223
 	$temp = substr($temp, strpos($temp, "=")+3, -3);
235 224
 	?>
236
-	<tr><td><span class="notice">*</span> Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
225
+	<tr><td><span class="notice">*</span> Website url that the tracker runs on, example: http://www.mywebsite.com</td>
237 226
 	<td><input type="text" name="website_url" size="40" value="<?php echo $temp;?>"></td></tr>
238 227
 	<?php
239 228
 	$temp = fgets($fr);
229
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
230
+	?>
231
+	<tr><td><span class="notice">*</span> Main announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
232
+	<td><input type="text" name="announce_url0" size="40" value="<?php echo $temp;?>"></td></tr>
233
+	<?php
234
+	$temp = fgets($fr);
235
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
236
+	?>
237
+	<tr><td>Secondary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
238
+	<td><input type="text" name="announce_url1" size="40" value="<?php echo $temp;?>"></td></tr>
239
+	<?php
240
+	$temp = fgets($fr);
241
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
242
+	?>
243
+	<tr><td>Tertiary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
244
+	<td><input type="text" name="announce_url2" size="40" value="<?php echo $temp;?>"></td></tr>
245
+	<?php
246
+	$temp = fgets($fr);
247
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
248
+	?>
249
+	<tr><td>Quaternary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
250
+	<td><input type="text" name="announce_url3" size="40" value="<?php echo $temp;?>"></td></tr>
251
+	<?php
252
+	$temp = fgets($fr);
253
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
254
+	?>
255
+	<tr><td>Quinary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
256
+	<td><input type="text" name="announce_url4" size="40" value="<?php echo $temp;?>"></td></tr>
257
+	<?php
258
+	$temp = fgets($fr);
240 259
 	$temp = substr($temp, strpos($temp, "=")+2, -2);
241 260
 	?>
242 261
 	<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>
... ...
@@ -342,7 +361,7 @@ if (!isset($_POST["saveconfig"]))
342 361
 if (isset($_POST["saveconfig"]))
343 362
 {
344 363
 	//check required entries for values, if blank: error out
345
-	if ($_POST["announceurl"] == "")
364
+	if ($_POST["announce_url0"] == "")
346 365
 	{
347 366
 		echo errorMessage() . "Error: The announce URL is blank.</p>";
348 367
 		exit();
... ...
@@ -409,7 +428,12 @@ if (isset($_POST["saveconfig"]))
409 428
 	}
410 429
 	if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
411 430
 	{
412
-		echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
431
+		echo errorMessage() . "Error: The website URL list does not start with http:// or is blank.</p>";
432
+		exit();
433
+	}
434
+	if ($_POST["announce_url0"] == "" || Substr($_POST["announce_url0"], 0, 7) != "http://")
435
+	{
436
+		echo errorMessage() . "Error: The announce URL list does not start with http:// or is blank.</p>";
413 437
 		exit();
414 438
 	}
415 439
 	if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
... ...
@@ -496,7 +520,6 @@ if (isset($_POST["saveconfig"]))
496 520
 		"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
497 521
 		"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
498 522
 		"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
499
-		"\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n" .
500 523
 		"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
501 524
 		"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
502 525
 		"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
... ...
@@ -520,6 +543,11 @@ if (isset($_POST["saveconfig"]))
520 543
 		"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
521 544
 		"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
522 545
 		"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
546
+		"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
547
+		"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
548
+		"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
549
+		"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
550
+		"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
523 551
 		"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
524 552
 		"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
525 553
 		"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
... ...
@@ -363,6 +363,13 @@ function sendRandomPeers($info_hash)
363 363
 			echo str_pad($row[0], 6, chr(32));
364 364
 	}
365 365
 	else
366
+	if ($column == "compact")
367
+	{
368
+		echo (mysql_num_rows($result) * 18) . ":";
369
+		while ($row = mysql_fetch_row($result))
370
+			echo str_pad($row[0], 18, chr(32));
371
+	}
372
+	else
366 373
 	{
367 374
 		echo "l";
368 375
 		while ($row = mysql_fetch_row($result))
... ...
@@ -321,7 +321,11 @@ if ($GLOBALS["customtitle"] != "true")
321 321
 		echo "&dn=".rawurlencode($data[9]);
322 322
 		else echo "&dn=".rawurlencode($data[5]);
323 323
 		//tracker url
324
-		echo "&tr=".$website_url . substr($_SERVER['PHP_SELF'], 0, -9) . $announceurl;
324
+		echo "&tr=".$announce_url0;
325
+		echo "&tr=".$announce_url1;
326
+		echo "&tr=".$announce_url2;
327
+		echo "&tr=".$announce_url3;
328
+		echo "&tr=".$announce_url4;
325 329
 	echo "'>(Magnet";
326 330
 	echo "<img src='images/magnet-icon.gif' border='0' class='icon' alt='Magnet Link' title='Magnet Link' />";
327 331
 	echo ")</a>";
... ...
@@ -21,7 +21,6 @@ if (isset($_POST["download"]))
21 21
 	print "\$GLOBALS['hiddentracker'] = " . htmlspecialchars($_POST["hiddentracker"]) . ";\n";
22 22
 	print "\$GLOBALS['scrape'] = " . htmlspecialchars($_POST["scrape"]) . ";\n";
23 23
 	print "\$GLOBALS['customtitle'] = " . htmlspecialchars($_POST["customtitle"]) . ";\n";
24
-	print "\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n";
25 24
 	print "\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n";
26 25
 	print "\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n";
27 26
 	print "\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n";
... ...
@@ -45,6 +44,11 @@ if (isset($_POST["download"]))
45 44
 	print "\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n";
46 45
 	print "\$rss_description = '" . htmlspecialchars($_POST["rss_description"]) . "';\n";
47 46
 	print "\$website_url = '" . htmlspecialchars($_POST['website_url']) . "';\n";
47
+	print "\$announce_url0 = '" . htmlspecialchars($_POST['announce_url0']) . "';\n";
48
+	print "\$announce_url1 = '" . htmlspecialchars($_POST['announce_url1']) . "';\n";
49
+	print "\$announce_url2 = '" . htmlspecialchars($_POST['announce_url2']) . "';\n";
50
+	print "\$announce_url3 = '" . htmlspecialchars($_POST['announce_url3']) . "';\n";
51
+	print "\$announce_url4 = '" . htmlspecialchars($_POST['announce_url4']) . "';\n";
48 52
 	print "\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n";
49 53
 	print "\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n";
50 54
 	print "\$dateformat = '" . htmlspecialchars($_POST['dateformat']) . "';\n";
... ...
@@ -334,17 +338,6 @@ echo ("<br><br>");
334 338
 		different from the filename.</td>
335 339
 		<td><input type="checkbox" name="customtitle"></td></tr>
336 340
 
337
-		<tr><td>Short Announce URL: You can enable the short announce feature, making the URL end in /announce for
338
-		your tracker.  You should not utilize both tracker URL forms in one torrent at the same time, or you will get
339
-		inconsistent results.  Note: You will need the provided htaccess file, have URL rewrite capabilities, and have
340
-		it properly set up to use this feature.  Otherwise, leave it disabled.</td>
341
-		<td><select name="announceurl" id="announceurl">
342
-		<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
343
-		<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
344
-		</select>
345
-		</td>
346
-		</tr>
347
-
348 341
 		<tr><td><span class="notice">* </span>Lists the number of torrents on each page on your torrent tracker list.  Default is 10.</td>
349 342
 		<td><input type="text" name="indexpagelimitspecify" size="40" value="10"></td></tr>
350 343
 
... ...
@@ -421,6 +414,21 @@ echo ("<br><br>");
421 414
 		
422 415
 		<tr><td><span class="notice">* </span>Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
423 416
 		<td><input type="text" name="website_url" size="40"></td></tr>
417
+
418
+		<tr><td><span class="notice">* </span>Primary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
419
+		<td><input type="text" name="announce_url0" size="40"></td></tr>
420
+
421
+		<tr><td>Secondary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
422
+		<td><input type="text" name="announce_url1" size="40"></td></tr>
423
+
424
+		<tr><td>Tertiary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
425
+		<td><input type="text" name="announce_url2" size="40"></td></tr>
426
+
427
+		<tr><td>Quaternary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
428
+		<td><input type="text" name="announce_url3" size="40"></td></tr>
429
+
430
+		<tr><td>Quinary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
431
+		<td><input type="text" name="announce_url4" size="40"></td></tr>
424 432
 		
425 433
 		<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>
426 434
 		<td><input type="text" name="max_upload_rate" size="40" value="100"></td></tr>
... ...
@@ -509,7 +517,7 @@ echo ("<br><br>");
509 517
 	if (isset($_POST["config"]))
510 518
 	{
511 519
 		//check required entries for values, if blank: error out
512
-		if ($_POST["announceurl"] == "")
520
+		if ($_POST["announce_url0"] == "")
513 521
 		{
514 522
 			echo errorMessage() . "Error: The announce URL is blank.</p>";
515 523
 			exit();
... ...
@@ -589,6 +597,11 @@ echo ("<br><br>");
589 597
 			echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
590 598
 			exit();
591 599
 		}
600
+		if ($_POST["announce_url0"] == "" || Substr($_POST["announce_url0"], 0, 7) != "http://")
601
+		{
602
+			echo errorMessage() . "Error: The announce URL does not start with http:// or is blank.</p>";
603
+			exit();
604
+		}
592 605
 		if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
593 606
 		{
594 607
 			echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
... ...
@@ -660,7 +673,6 @@ echo ("<br><br>");
660 673
 			"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
661 674
 			"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
662 675
 			"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
663
-			"\$announceurl = " . htmlspecialchars($_POST["announceurl"]) . ";\n" .
664 676
 			"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
665 677
 			"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
666 678
 			"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
... ...
@@ -684,6 +696,11 @@ echo ("<br><br>");
684 696
 			"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
685 697
 			"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
686 698
 			"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
699
+			"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
700
+			"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
701
+			"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
702
+			"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
703
+			"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
687 704
 			"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
688 705
 			"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
689 706
 			"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
... ...
@@ -708,7 +725,6 @@ echo ("<br><br>");
708 725
 			<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
709 726
 			<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
710 727
 			<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
711
-			<input type="hidden" name="announceurl" value="<?php echo $_POST['announceurl'];?>">
712 728
 			<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
713 729
 			<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
714 730
 			<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
... ...
@@ -732,6 +748,11 @@ echo ("<br><br>");
732 748
 			<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
733 749
 			<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
734 750
 			<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
751
+			<input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
752
+			<input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
753
+			<input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
754
+			<input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
755
+			<input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
735 756
 			<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
736 757
 			<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
737 758
 			<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
... ...
@@ -22,7 +22,7 @@ if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
22 22
 <body>
23 23
 
24 24
 <?php
25
-$tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
25
+$tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
26 26
 
27 27
 if (isset($_FILES["torrent"]))
28 28
 	addTorrent();
... ...
@@ -34,7 +34,7 @@ endOutput();
34 34
 function addTorrent()
35 35
 {
36 36
 	require ("config.php");
37
-	$tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
37
+	$tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
38 38
 	
39 39
 	$hash = strtolower($_POST["hash"]);
40 40
 
... ...
@@ -70,15 +70,16 @@ function addTorrent()
70 70
 			}
71 71
 			if ($found_tracker == false)
72 72
 			{
73
-				echo errorMessage() . "Error: Multiple trackers were found but none of them match the
74
-					announce URL:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
73
+				echo errorMessage() . "Error: Multiple trackers were found but none of them match the primary
74
+					announce URL:<br>$tracker_url<br><br>or any alternate URLs:<br>$announce_url1<br>$announce_url2<br>$announce_url3<br>$announce_url4<br><br>Please re-create and re-upload the torrent.</p>\n";
75 75
 				endOutput();
76 76
 				exit;
77 77
 			}
78 78
 		} else {
79 79
 			//a single tracker is listed
80 80
 			if (strtolower($array["announce"]) != $tracker_url) {
81
-				echo errorMessage() . "Error: The tracker announce URL does not match this:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
81
+				echo errorMessage() . "Error: The tracker announce URL does not match the primary
82
+					announce URL:<br>$tracker_url<br><br>or any alternate URLs:<br>$announce_url1<br>$announce_url2<br>$announce_url3<br>$announce_url4<br><br>Please re-create and re-upload the torrent.</p>\n";
82 83
 				endOutput();
83 84
 				exit;
84 85
 			}
... ...
@@ -235,12 +236,17 @@ function addTorrent()
235 236
 function endOutput() 
236 237
 {
237 238
 	require ("config.php");
238
-	$tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
239
+	$tracker_url = $announce_url0;
240
+	$alt_tracker_url1 = $announce_url1;
241
+	$alt_tracker_url2 = $announce_url2;
242
+	$alt_tracker_url3 = $announce_url3;
243
+	$alt_tracker_url4 = $announce_url4;
239 244
 	?>
240 245
 	<p align="right"><a href="./docs/help.html"><img src="images/help.png" border="0" class="icon" alt="Help" title="Help" /></a><a href="./docs/help.html">Help</a></p>
241 246
 	<div class="center">
242 247
 	<h1>Add Torrent to Tracker Database</h1>
243
-	<h3>Tracker URL: <?php echo $tracker_url;?></h3>
248
+	<h3>Tracker URL: <br> <?php echo $tracker_url;?></h3>
249
+	<h4>Alternate Tracker URLs: <br> <?php echo $alt_tracker_url1;?> <br> <?php echo $alt_tracker_url2;?> <br> <?php echo $alt_tracker_url3;?> <br> <?php echo $alt_tracker_url4; ?> </h4>
244 250
 	<form enctype="multipart/form-data" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
245 251
 	<table>
246 252
 	<tr>
... ...
@@ -1,3 +1,29 @@
1
+<?php
2
+//if config.php file not available, error out
3
+if (!file_exists("config.php"))
4
+{
5
+	echo "<font color=red><strong>Error: config.php file is not available.  Did you forget to upload it?" .
6
+	" If you haven't run the installer yet, please do so <a href=\"install.php\">here.</a></strong></font>";
7
+	exit();
8
+}
9
+
10
+require_once ("config.php");
11
+require_once ("funcsv2.php");
12
+
13
+//Check session only if hiddentracker is TRUE
14
+if ($hiddentracker == true)
15
+{
16
+	session_start();
17
+	
18
+	if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
19
+	{
20
+		//check fails
21
+		header("Location: authenticate.php?status=indexlogin");
22
+		exit();
23
+	}
24
+}
25
+?>
26
+
1 27
 <?php
2 28
 
3 29
 require_once("BDecode.php");
... ...
@@ -1,3 +1,29 @@
1
+<?php
2
+//if config.php file not available, error out
3
+if (!file_exists("config.php"))
4
+{
5
+	echo "<font color=red><strong>Error: config.php file is not available.  Did you forget to upload it?" .
6
+	" If you haven't run the installer yet, please do so <a href=\"install.php\">here.</a></strong></font>";
7
+	exit();
8
+}
9
+
10
+require_once ("config.php");
11
+require_once ("funcsv2.php");
12
+
13
+//Check session only if hiddentracker is TRUE
14
+if ($hiddentracker == true)
15
+{
16
+	session_start();
17
+	
18
+	if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
19
+	{
20
+		//check fails
21
+		header("Location: authenticate.php?status=indexlogin");
22
+		exit();
23
+	}
24
+}
25
+?>
26
+
1 27
 <?php
2 28
 
3 29
 header("Content-type: text/plain");
... ...
@@ -125,7 +151,7 @@ if (!isset($_GET["port"]) || !isset($_GET["downloaded"]) || !isset($_GET["upload
125 151
 }
126 152
 
127 153
 $port = filterInt($_GET["port"]);
128
-$ip = filterFloat(str_replace("::ffff:", "", $_SERVER["REMOTE_ADDR"]));
154
+$ip = filterChar(str_replace("::ffff:", "", $_SERVER["REMOTE_ADDR"]));
129 155
 $downloaded = filterFloat($_GET["downloaded"]);
130 156
 $uploaded = filterFloat($_GET["uploaded"]);
131 157
 $left = filterFloat($_GET["left"]);
... ...
@@ -196,13 +222,17 @@ function start($info_hash, $ip, $port, $peer_id, $left)
196 222
 		}
197 223
 	  }
198 224
 	}
225
+	
226
+//	if (preg_match("/^[a-f]+$/i", $ip)) { // Disable compact announce with IPv6
227
+//		$compact = 0;
228
+//	}
199 229
 
200 230
 	if (isset($_GET["ip"]) && $GLOBALS["ip_override"])
201 231
 	{
202 232
 		// compact check: valid IP address:
203 233
 		if (ip2long($_GET["ip"]) == -1)
204 234
 			showError("Invalid IP address. Must be standard dotted decimal (hostnames not allowed)");
205
-		$ip = filterFloat($_GET["ip"]);
235
+		$ip = filterChar($_GET["ip"]);
206 236
 	}
207 237
 
208 238
 	if ($left == 0)
... ...
@@ -1,3 +1,3 @@
1 1
 <?php
2
-echo "Version: 1.04";
2
+echo "Version: 1.05";
3 3
 ?>
4 4
\ No newline at end of file