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
--- a/batch_upload.php
+++ b/batch_upload.php
@@ -56,7 +56,7 @@
require_once ("BDecode.php");
require_once ("BEncode.php");
- $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -16) . $announceurl;
+ $tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
$array = BDecode($buffer);
if (!$array)
@@ -75,15 +75,16 @@
}
if ($found_tracker == false)
{
- echo errorMessage() . "Error: Multiple trackers were found but none of them match the
- announce URL:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
+ echo errorMessage() . "Error: Multiple trackers were found but none of them match the primary
+ 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";
$error_status = false;
exit;
}
} else {
//a single tracker is listed
if (strtolower($array["announce"]) != $tracker_url) {
- 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";
+ echo errorMessage() . "Error: The tracker announce URL does not match the primary
+ 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";
$error_status = false;
exit;
}
@@ -176,7 +177,7 @@
{
//display upload box
?>
- <?php require("config.php"); $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -16) . $announceurl; ?>
+ <?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;?>
<p>This page lets you upload a zip file containing multiple torrents and add them into the database. The
zip file cannot have any folders in it. This requires that you are running PHP with compiled zip support.
If you are unsure, check with your system administrator or phpinfo(). Any torrents that already exist in
@@ -189,7 +190,8 @@
[1] Even if the custom title option is enabled, the torrents will have the same title as the filename. If you
have the custom title option enabled, you may change the titles to your preference after the batch upload has
finished.<br>[2] The torrents you are batch uploading should include the following Tracker URL:
- <b><?php echo $tracker_url ?></b></p>
+ <br><b><?php echo $tracker_url ?></b><br> or its alternate tracker URLs: <br><b><?php echo $alt_tracker_url1;?> <br>
+ <?php echo $alt_tracker_url2;?> <br> <?php echo $alt_tracker_url3;?> <br> <?php echo $alt_tracker_url4; ?></b></p>
<?php
if (function_exists("zip_open"))
--- a/dltorrent.php
+++ b/dltorrent.php
@@ -2,21 +2,12 @@
require_once ("config.php");
-//Check session only if hiddentracker is TRUE
-if ($hiddentracker == true)
+session_start();
+
+if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
{
- session_start();
-
- if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
- {
- //check fails
- header("Location: authenticate.php?status=error");
- exit();
- }
-}
-else
-{
- //don't run
+ //check fails
+ header("Location: authenticate.php?status=session");
exit();
}
--- a/editconfig.php
+++ b/editconfig.php
@@ -60,17 +60,6 @@
<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, "=")+3, -3);
- ?>
- <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>
- <td><select name="announceurl" id="announceurl">
- <option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
- <option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
- </select>
- </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>
@@ -233,8 +222,38 @@
$temp = fgets($fr);
$temp = substr($temp, strpos($temp, "=")+3, -3);
?>
- <tr><td><span class="notice">*</span> Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
+ <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);
@@ -342,7 +361,7 @@
if (isset($_POST["saveconfig"]))
{
//check required entries for values, if blank: error out
- if ($_POST["announceurl"] == "")
+ if ($_POST["announce_url0"] == "")
{
echo errorMessage() . "Error: The announce URL is blank.</p>";
exit();
@@ -409,7 +428,12 @@
}
if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
{
- echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
+ 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)
@@ -496,7 +520,6 @@
"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
- "\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n" .
"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
@@ -520,6 +543,11 @@
"\$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" .
--- a/funcsv2.php
+++ b/funcsv2.php
@@ -363,6 +363,13 @@
echo str_pad($row[0], 6, chr(32));
}
else
+ if ($column == "compact")
+ {
+ echo (mysql_num_rows($result) * 18) . ":";
+ while ($row = mysql_fetch_row($result))
+ echo str_pad($row[0], 18, chr(32));
+ }
+ else
{
echo "l";
while ($row = mysql_fetch_row($result))
--- a/index.php
+++ b/index.php
@@ -321,7 +321,11 @@
echo "&dn=".rawurlencode($data[9]);
else echo "&dn=".rawurlencode($data[5]);
//tracker url
- echo "&tr=".$website_url . substr($_SERVER['PHP_SELF'], 0, -9) . $announceurl;
+ echo "&tr=".$announce_url0;
+ echo "&tr=".$announce_url1;
+ echo "&tr=".$announce_url2;
+ echo "&tr=".$announce_url3;
+ echo "&tr=".$announce_url4;
echo "'>(Magnet";
echo "<img src='images/magnet-icon.gif' border='0' class='icon' alt='Magnet Link' title='Magnet Link' />";
echo ")</a>";
--- a/install.php
+++ b/install.php
@@ -21,7 +21,6 @@
print "\$GLOBALS['hiddentracker'] = " . htmlspecialchars($_POST["hiddentracker"]) . ";\n";
print "\$GLOBALS['scrape'] = " . htmlspecialchars($_POST["scrape"]) . ";\n";
print "\$GLOBALS['customtitle'] = " . htmlspecialchars($_POST["customtitle"]) . ";\n";
- print "\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n";
print "\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n";
print "\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n";
print "\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n";
@@ -45,6 +44,11 @@
print "\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n";
print "\$rss_description = '" . htmlspecialchars($_POST["rss_description"]) . "';\n";
print "\$website_url = '" . htmlspecialchars($_POST['website_url']) . "';\n";
+ print "\$announce_url0 = '" . htmlspecialchars($_POST['announce_url0']) . "';\n";
+ print "\$announce_url1 = '" . htmlspecialchars($_POST['announce_url1']) . "';\n";
+ print "\$announce_url2 = '" . htmlspecialchars($_POST['announce_url2']) . "';\n";
+ print "\$announce_url3 = '" . htmlspecialchars($_POST['announce_url3']) . "';\n";
+ print "\$announce_url4 = '" . htmlspecialchars($_POST['announce_url4']) . "';\n";
print "\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n";
print "\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n";
print "\$dateformat = '" . htmlspecialchars($_POST['dateformat']) . "';\n";
@@ -334,17 +338,6 @@
different from the filename.</td>
<td><input type="checkbox" name="customtitle"></td></tr>
- <tr><td>Short Announce URL: You can enable 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>
- <td><select name="announceurl" id="announceurl">
- <option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
- <option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
- </select>
- </td>
- </tr>
-
<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="10"></td></tr>
@@ -421,6 +414,21 @@
<tr><td><span class="notice">* </span>Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
<td><input type="text" name="website_url" size="40"></td></tr>
+
+ <tr><td><span class="notice">* </span>Primary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
+ <td><input type="text" name="announce_url0" size="40"></td></tr>
+
+ <tr><td>Secondary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
+ <td><input type="text" name="announce_url1" size="40"></td></tr>
+
+ <tr><td>Tertiary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
+ <td><input type="text" name="announce_url2" size="40"></td></tr>
+
+ <tr><td>Quaternary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
+ <td><input type="text" name="announce_url3" size="40"></td></tr>
+
+ <tr><td>Quinary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
+ <td><input type="text" name="announce_url4" size="40"></td></tr>
<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="100"></td></tr>
@@ -509,7 +517,7 @@
if (isset($_POST["config"]))
{
//check required entries for values, if blank: error out
- if ($_POST["announceurl"] == "")
+ if ($_POST["announce_url0"] == "")
{
echo errorMessage() . "Error: The announce URL is blank.</p>";
exit();
@@ -587,6 +595,11 @@
if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
{
echo errorMessage() . "Error: The website URL 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 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)
@@ -660,7 +673,6 @@
"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
- "\$announceurl = " . htmlspecialchars($_POST["announceurl"]) . ";\n" .
"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
@@ -684,6 +696,11 @@
"\$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" .
@@ -708,7 +725,6 @@
<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
- <input type="hidden" name="announceurl" value="<?php echo $_POST['announceurl'];?>">
<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
@@ -732,6 +748,11 @@
<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
+ <input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
+ <input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
+ <input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
+ <input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
+ <input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
--- a/newtorrents.php
+++ b/newtorrents.php
@@ -22,7 +22,7 @@
<body>
<?php
-$tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
+$tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
if (isset($_FILES["torrent"]))
addTorrent();
@@ -34,7 +34,7 @@
function addTorrent()
{
require ("config.php");
- $tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
+ $tracker_url = $announce_url0 OR $announce_url1 OR $announce_url2 OR $announce_url3 OR $announce_url4;
$hash = strtolower($_POST["hash"]);
@@ -70,15 +70,16 @@
}
if ($found_tracker == false)
{
- echo errorMessage() . "Error: Multiple trackers were found but none of them match the
- announce URL:<br>$tracker_url<br>Please re-create and re-upload the torrent.</p>\n";
+ echo errorMessage() . "Error: Multiple trackers were found but none of them match the primary
+ 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";
endOutput();
exit;
}
} else {
//a single tracker is listed
if (strtolower($array["announce"]) != $tracker_url) {
- 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";
+ echo errorMessage() . "Error: The tracker announce URL does not match the primary
+ 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";
endOutput();
exit;
}
@@ -235,12 +236,17 @@
function endOutput()
{
require ("config.php");
- $tracker_url = $website_url . substr($_SERVER['PHP_SELF'], 0, -15) . $announceurl;
+ $tracker_url = $announce_url0;
+ $alt_tracker_url1 = $announce_url1;
+ $alt_tracker_url2 = $announce_url2;
+ $alt_tracker_url3 = $announce_url3;
+ $alt_tracker_url4 = $announce_url4;
?>
<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>
<div class="center">
<h1>Add Torrent to Tracker Database</h1>
- <h3>Tracker URL: <?php echo $tracker_url;?></h3>
+ <h3>Tracker URL: <br> <?php echo $tracker_url;?></h3>
+ <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>
<form enctype="multipart/form-data" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
<table>
<tr>
--- a/torrent_functions.php
+++ b/torrent_functions.php
@@ -1,3 +1,29 @@
+<?php
+//if config.php file not available, error out
+if (!file_exists("config.php"))
+{
+ echo "<font color=red><strong>Error: config.php file is not available. Did you forget to upload it?" .
+ " If you haven't run the installer yet, please do so <a href=\"install.php\">here.</a></strong></font>";
+ exit();
+}
+
+require_once ("config.php");
+require_once ("funcsv2.php");
+
+//Check session only if hiddentracker is TRUE
+if ($hiddentracker == true)
+{
+ session_start();
+
+ if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
+ {
+ //check fails
+ header("Location: authenticate.php?status=indexlogin");
+ exit();
+ }
+}
+?>
+
<?php
require_once("BDecode.php");
--- a/tracker.php
+++ b/tracker.php
@@ -1,3 +1,29 @@
+<?php
+//if config.php file not available, error out
+if (!file_exists("config.php"))
+{
+ echo "<font color=red><strong>Error: config.php file is not available. Did you forget to upload it?" .
+ " If you haven't run the installer yet, please do so <a href=\"install.php\">here.</a></strong></font>";
+ exit();
+}
+
+require_once ("config.php");
+require_once ("funcsv2.php");
+
+//Check session only if hiddentracker is TRUE
+if ($hiddentracker == true)
+{
+ session_start();
+
+ if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
+ {
+ //check fails
+ header("Location: authenticate.php?status=indexlogin");
+ exit();
+ }
+}
+?>
+
<?php
header("Content-type: text/plain");
@@ -125,7 +151,7 @@
}
$port = filterInt($_GET["port"]);
-$ip = filterFloat(str_replace("::ffff:", "", $_SERVER["REMOTE_ADDR"]));
+$ip = filterChar(str_replace("::ffff:", "", $_SERVER["REMOTE_ADDR"]));
$downloaded = filterFloat($_GET["downloaded"]);
$uploaded = filterFloat($_GET["uploaded"]);
$left = filterFloat($_GET["left"]);
@@ -196,13 +222,17 @@
}
}
}
+
+// if (preg_match("/^[a-f]+$/i", $ip)) { // Disable compact announce with IPv6
+// $compact = 0;
+// }
if (isset($_GET["ip"]) && $GLOBALS["ip_override"])
{
// compact check: valid IP address:
if (ip2long($_GET["ip"]) == -1)
showError("Invalid IP address. Must be standard dotted decimal (hostnames not allowed)");
- $ip = filterFloat($_GET["ip"]);
+ $ip = filterChar($_GET["ip"]);
}
if ($left == 0)
--- a/version.php
+++ b/version.php
@@ -1,3 +1,3 @@
<?php
-echo "Version: 1.04";
+echo "Version: 1.05";
?>