| ... | ... |
@@ -109,6 +109,12 @@ if ($hiddentracker == true) |
| 109 | 109 |
echo "Hello, <i>" . $_SESSION["username"] . "</i><br>"; |
| 110 | 110 |
echo "<a href=\"authenticate.php?status=logout\"><img src=\"images/logout.png\" border=\"0\" class=\"icon\" alt=\"Logout\" title=\"Logout\" /></a><a href=\"authenticate.php?status=logout\">Logout</a>"; |
| 111 | 111 |
} |
| 112 |
+ |
|
| 113 |
+session_start(); |
|
| 114 |
+if ($_SESSION['upload_logged_in']) |
|
| 115 |
+{
|
|
| 116 |
+ echo "<a href=\"authenticate.php?status=logout\"><img src=\"images/logout.png\" border=\"0\" class=\"icon\" alt=\"Logout\" title=\"Logout\" /></a><a href=\"authenticate.php?status=logout\">Logout</a>"; |
|
| 117 |
+} |
|
| 112 | 118 |
?> |
| 113 | 119 |
</td> |
| 114 | 120 |
<td align="center"> |
| ... | ... |
@@ -133,14 +133,14 @@ if (file_exists("rss/rss.xml"))
|
| 133 | 133 |
<?php |
| 134 | 134 |
//Cleanup page number to prevent XSS |
| 135 | 135 |
if (isset($_GET["page_number"])) {
|
| 136 |
- $_GET["page_number"] = htmlspecialchars($_GET["page_number"]); |
|
| 136 |
+ $_GET["page_number"] = htmlentities($_GET["page_number"], ENT_QUOTES); |
|
| 137 | 137 |
} else {
|
| 138 | 138 |
$_GET["page_number"] = ""; |
| 139 | 139 |
} |
| 140 | 140 |
$scriptname = htmlspecialchars($scriptname); |
| 141 | 141 |
|
| 142 | 142 |
if (!isset($_GET["activeonly"])) |
| 143 |
- $scriptname = $scriptname . "activeonly= yes&"; |
|
| 143 |
+ $scriptname = $scriptname . "activeonly=yes&"; |
|
| 144 | 144 |
if (isset($_GET["seededonly"]) && !isset($_GET["activeonly"])) |
| 145 | 145 |
{
|
| 146 | 146 |
$scriptname = $scriptname . "seededonly=yes&"; |
| ... | ... |
@@ -394,10 +394,11 @@ if ($GLOBALS["countbytes"]) //stop count bytes variable |
| 394 | 394 |
</tr></table></td></tr> |
| 395 | 395 |
<table> |
| 396 | 396 |
<tr class="details"> |
| 397 |
- <td align="left"><a href="http://www.rivetcode.com">RivetTracker</a> |
|
| 397 |
+ <td align="left"> |
|
| 398 | 398 |
<?php |
| 399 | 399 |
require("version.php");
|
| 400 |
- print($version); |
|
| 400 |
+ echo($id); |
|
| 401 |
+ echo($version); |
|
| 401 | 402 |
?> |
| 402 | 403 |
</td> |
| 403 | 404 |
<td align="right"> |
| ... | ... |
@@ -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>"; |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,424 @@ |
| 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 |
+ |
|
| 27 |
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|
| 28 |
+ |
|
| 29 |
+<?php |
|
| 30 |
+//variables for column totals |
|
| 31 |
+$total_disk_usage = 0; |
|
| 32 |
+$total_seeders = 0; |
|
| 33 |
+$total_leechers = 0; |
|
| 34 |
+$total_downloads = 0; |
|
| 35 |
+$total_bytes_transferred = 0; |
|
| 36 |
+$total_speed = 0; |
|
| 37 |
+ |
|
| 38 |
+$scriptname = $_SERVER["PHP_SELF"] . "?"; |
|
| 39 |
+if (!isset($GLOBALS["countbytes"])) |
|
| 40 |
+ $GLOBALS["countbytes"] = true; |
|
| 41 |
+?> |
|
| 42 |
+<html> |
|
| 43 |
+<head> |
|
| 44 |
+ <title><?php if ($GLOBALS["title"] != "") echo $GLOBALS["title"]; else echo "Tracker Statistics";?></title> |
|
| 45 |
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
|
| 46 |
+ <link rel="stylesheet" href="./css/style.css" type="text/css" /> |
|
| 47 |
+ <?php |
|
| 48 |
+ if ($enablerss == true) |
|
| 49 |
+ echo "<link rel=\"alternate\" title=\"" . $rss_title . "\" href=\"rss/rss.xml\" type=\"application/rss+xml\">"; |
|
| 50 |
+ ?> |
|
| 51 |
+</head> |
|
| 52 |
+<body> |
|
| 53 |
+<?php |
|
| 54 |
+//display total stats as header on page |
|
| 55 |
+if ($GLOBALS["persist"]) |
|
| 56 |
+ $db = mysql_pconnect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Tracker error: can't connect to database - " . mysql_error() . "</p>"); |
|
| 57 |
+else |
|
| 58 |
+ $db = mysql_connect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Tracker error: can't connect to database - " . mysql_error() . "</p>"); |
|
| 59 |
+mysql_select_db($database) or die(errorMessage() . "Tracker error: can't open database $database - " . mysql_error() . "</p>"); |
|
| 60 |
+ |
|
| 61 |
+$query = "SELECT SUM(".$prefix."namemap.size), SUM(".$prefix."summary.seeds), SUM(".$prefix."summary.leechers), SUM(".$prefix."summary.finished), SUM(".$prefix."summary.dlbytes), SUM(".$prefix."summary.speed) FROM ".$prefix."summary LEFT JOIN ".$prefix."namemap ON ".$prefix."summary.info_hash = ".$prefix."namemap.info_hash";
|
|
| 62 |
+$results = mysql_query($query) or die(errorMessage() . "Can't do SQL query - " . mysql_error() . "</p>"); |
|
| 63 |
+$data = mysql_fetch_row($results); |
|
| 64 |
+?> |
|
| 65 |
+ |
|
| 66 |
+<center> |
|
| 67 |
+<table> |
|
| 68 |
+<tr> |
|
| 69 |
+<th class="subheader">Total Space Used</th> |
|
| 70 |
+<th class="subheader">Seeders</th> |
|
| 71 |
+<th class="subheader">Leechers</th> |
|
| 72 |
+<th class="subheader">Completed D/Ls</th> |
|
| 73 |
+<th class="subheader">Bytes Transferred</th> |
|
| 74 |
+<th class="subheader">Speed (rough estimate)</th> |
|
| 75 |
+</tr> |
|
| 76 |
+<tr> |
|
| 77 |
+<?php |
|
| 78 |
+if ($data[0] != null) //if there are no torrents in database, don't show anything |
|
| 79 |
+{
|
|
| 80 |
+ echo "<td align=\"center\">" . bytesToString($data[0]) . "</td>\n"; |
|
| 81 |
+ echo "<td align=\"center\">" . $data[1] . "</td>\n"; |
|
| 82 |
+ echo "<td align=\"center\">" . $data[2] . "</td>\n"; |
|
| 83 |
+ echo "<td align=\"center\">" . $data[3] . "</td>\n"; |
|
| 84 |
+ echo "<td align=\"center\">" . bytesToString($data[4]) . "</td>\n"; |
|
| 85 |
+ if ($GLOBALS["countbytes"]) //stop count bytes OFF, OK to do speed calculation |
|
| 86 |
+ {
|
|
| 87 |
+ if ($data[5] > 2097152) |
|
| 88 |
+ echo "<td align=\"center\">" . round($data[5] / 1048576, 2) . " MB/sec</td>\n"; |
|
| 89 |
+ else |
|
| 90 |
+ echo "<td align=\"center\">" . round($data[5] / 1024, 2) . " KB/sec</td>\n"; |
|
| 91 |
+ } |
|
| 92 |
+ else |
|
| 93 |
+ echo "<td align=\"center\">No Info Available</td>\n"; |
|
| 94 |
+} |
|
| 95 |
+?> |
|
| 96 |
+</tr> |
|
| 97 |
+</table> |
|
| 98 |
+</center> |
|
| 99 |
+<br> |
|
| 100 |
+ |
|
| 101 |
+<h1><?php if ($GLOBALS["title"] != "") echo $GLOBALS["title"]; else echo "Tracker Statistics";?></h1> |
|
| 102 |
+<table width="100%"> |
|
| 103 |
+<tr> |
|
| 104 |
+<td width="25%"> |
|
| 105 |
+<?php |
|
| 106 |
+//Display logout option if logged in |
|
| 107 |
+if ($hiddentracker == true) |
|
| 108 |
+{
|
|
| 109 |
+ echo "Hello, <i>" . $_SESSION["username"] . "</i><br>"; |
|
| 110 |
+ echo "<a href=\"authenticate.php?status=logout\"><img src=\"images/logout.png\" border=\"0\" class=\"icon\" alt=\"Logout\" title=\"Logout\" /></a><a href=\"authenticate.php?status=logout\">Logout</a>"; |
|
| 111 |
+} |
|
| 112 |
+?> |
|
| 113 |
+</td> |
|
| 114 |
+<td align="center"> |
|
| 115 |
+<a href="newtorrents.php"><img src="images/add.png" border="0" class="icon" alt="Add Torrent" title="Add Torrent" /></a><a href="newtorrents.php">Add Torrent to Tracker Database</a> |
|
| 116 |
+<a href="admin.php"><img src="images/admin.png" border="0" class="icon" alt="Admin Page" title="Admin Page" /></a><a href="admin.php">Admin Page</a> |
|
| 117 |
+</td> |
|
| 118 |
+<td align="right" width="25%"> |
|
| 119 |
+ |
|
| 120 |
+<?php |
|
| 121 |
+if (file_exists("rss/rss.xml"))
|
|
| 122 |
+{
|
|
| 123 |
+ echo "<a href='rss/rss.xml'><img src='images/rss-logo.png' border='0' class='icon' alt='RSS 2.0 Feed' title='RSS 2.0 Feed' /></a><a href='rss/rss.xml'>RSS 2.0 Feed</a>"; |
|
| 124 |
+} |
|
| 125 |
+?> |
|
| 126 |
+</td> |
|
| 127 |
+</tr> |
|
| 128 |
+</table> |
|
| 129 |
+ |
|
| 130 |
+ |
|
| 131 |
+<table> |
|
| 132 |
+<tr> |
|
| 133 |
+ <?php |
|
| 134 |
+ //Cleanup page number to prevent XSS |
|
| 135 |
+ if (isset($_GET["page_number"])) {
|
|
| 136 |
+ $_GET["page_number"] = htmlspecialchars($_GET["page_number"]); |
|
| 137 |
+ } else {
|
|
| 138 |
+ $_GET["page_number"] = ""; |
|
| 139 |
+ } |
|
| 140 |
+ $scriptname = htmlspecialchars($scriptname); |
|
| 141 |
+ |
|
| 142 |
+ if (!isset($_GET["activeonly"])) |
|
| 143 |
+ $scriptname = $scriptname . "activeonly= yes&"; |
|
| 144 |
+ if (isset($_GET["seededonly"]) && !isset($_GET["activeonly"])) |
|
| 145 |
+ {
|
|
| 146 |
+ $scriptname = $scriptname . "seededonly=yes&"; |
|
| 147 |
+ $_GET["page_number"] = 1; |
|
| 148 |
+ } |
|
| 149 |
+ if (isset($_GET["page_number"])) |
|
| 150 |
+ $scriptname = $scriptname . "page_number=" . $_GET["page_number"] . "&"; |
|
| 151 |
+ |
|
| 152 |
+ if (isset($_GET["activeonly"])) |
|
| 153 |
+ echo "<td><a href=\"$scriptname\">Show all torrents</a></td>\n"; |
|
| 154 |
+ else |
|
| 155 |
+ echo "<td><a href=\"$scriptname\">Show only active torrents</a></td>\n"; |
|
| 156 |
+ |
|
| 157 |
+ $scriptname = $_SERVER["PHP_SELF"] . "?"; |
|
| 158 |
+ $scriptname = htmlspecialchars($scriptname); |
|
| 159 |
+ |
|
| 160 |
+ if (!isset($_GET["seededonly"])) |
|
| 161 |
+ $scriptname = $scriptname . "seededonly=yes&"; |
|
| 162 |
+ if (isset($_GET["activeonly"]) && !isset($_GET["seededonly"])) |
|
| 163 |
+ {
|
|
| 164 |
+ $scriptname = $scriptname . "activeonly=yes&"; |
|
| 165 |
+ $_GET["page_number"] = 1; |
|
| 166 |
+ } |
|
| 167 |
+ if (isset($_GET["page_number"])) |
|
| 168 |
+ $scriptname = $scriptname . "page_number=" . $_GET["page_number"] . "&"; |
|
| 169 |
+ |
|
| 170 |
+ if (isset($_GET["seededonly"])) |
|
| 171 |
+ echo "<td align=\"right\"><a href=\"$scriptname\">Show all torrents</a></td>\n"; |
|
| 172 |
+ else |
|
| 173 |
+ echo "<td align=\"right\"><a href=\"$scriptname\">Show only seeded torrents</a></td>\n"; |
|
| 174 |
+ |
|
| 175 |
+ $scriptname = $_SERVER["PHP_SELF"] . "?"; |
|
| 176 |
+ $scriptname = htmlspecialchars($scriptname); |
|
| 177 |
+ |
|
| 178 |
+ ?> |
|
| 179 |
+</tr> |
|
| 180 |
+</table> |
|
| 181 |
+ |
|
| 182 |
+<?php |
|
| 183 |
+if ($GLOBALS["persist"]) |
|
| 184 |
+ $db = mysql_pconnect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Tracker error: can't connect to database - " . mysql_error() . "</p>"); |
|
| 185 |
+else |
|
| 186 |
+ $db = mysql_connect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Tracker error: can't connect to database - " . mysql_error() . "</p>"); |
|
| 187 |
+mysql_select_db($database) or die(errorMessage() . "Tracker error: can't open database $database - " . mysql_error() . "</p>"); |
|
| 188 |
+ |
|
| 189 |
+if (isset($_GET["seededonly"])) |
|
| 190 |
+ $where = " WHERE seeds > 0"; |
|
| 191 |
+else if (isset($_GET["activeonly"])) |
|
| 192 |
+ $where = " WHERE leechers+seeds > 0"; |
|
| 193 |
+else |
|
| 194 |
+ $where = " "; |
|
| 195 |
+ |
|
| 196 |
+$query = "SELECT COUNT(*) FROM ".$prefix."summary $where"; |
|
| 197 |
+$results = mysql_query($query); |
|
| 198 |
+$res = mysql_result($results,0,0); |
|
| 199 |
+ |
|
| 200 |
+if (isset($_GET["activeonly"])) |
|
| 201 |
+ $scriptname = $scriptname . "activeonly=yes&"; |
|
| 202 |
+if (isset($_GET["seededonly"])) |
|
| 203 |
+ $scriptname = $scriptname . "seededonly=yes&"; |
|
| 204 |
+ |
|
| 205 |
+echo "<p align='center'>Page: \n"; |
|
| 206 |
+$count = 0; |
|
| 207 |
+$page = 1; |
|
| 208 |
+while($count < $res) |
|
| 209 |
+{
|
|
| 210 |
+ if (isset($_GET["page_number"]) && $page == $_GET["page_number"]) |
|
| 211 |
+ echo "<b><a href=\"$scriptname" . "page_number=$page\">($page)</a></b>-\n"; |
|
| 212 |
+ else if (!isset($_GET["page_number"]) && $page == 1) |
|
| 213 |
+ echo "<b><a href=\"$scriptname" . "page_number=$page\">($page)</a></b>-\n"; |
|
| 214 |
+ else |
|
| 215 |
+ echo "<a href=\"$scriptname" . "page_number=$page\">$page</a>-\n"; |
|
| 216 |
+ $page++; |
|
| 217 |
+ $count = $count + ($GLOBALS['indexpagelimitspecify']); |
|
| 218 |
+} |
|
| 219 |
+echo "</p>\n"; |
|
| 220 |
+?> |
|
| 221 |
+ |
|
| 222 |
+<table> |
|
| 223 |
+<tr> |
|
| 224 |
+ <td> |
|
| 225 |
+ <table class="torrentlist"> |
|
| 226 |
+ |
|
| 227 |
+ <!-- Column Headers --> |
|
| 228 |
+ <tr> |
|
| 229 |
+ <th>Name/Info Hash</th> |
|
| 230 |
+ <th>Seeders</th> |
|
| 231 |
+ <th>Leechers</th> |
|
| 232 |
+ <th>Completed D/Ls</th> |
|
| 233 |
+ <?php |
|
| 234 |
+ // Bytes mode off? Ignore the columns |
|
| 235 |
+ if ($GLOBALS["countbytes"]) |
|
| 236 |
+ echo '<th>Bytes Transferred</th><th>Speed (rough estimate)</th>'; |
|
| 237 |
+ ?> |
|
| 238 |
+ </tr> |
|
| 239 |
+ |
|
| 240 |
+<?php |
|
| 241 |
+if ($GLOBALS["customtitle"] != "true") |
|
| 242 |
+{
|
|
| 243 |
+ if (!isset($_GET["page_number"])) |
|
| 244 |
+ $query = "SELECT ".$prefix."summary.info_hash, ".$prefix."summary.seeds, ".$prefix."summary.leechers, ".$prefix."summary.finished, ".$prefix."summary.dlbytes, ".$prefix."namemap.filename, ".$prefix."namemap.url, ".$prefix."namemap.size, ".$prefix."summary.speed FROM ".$prefix."summary LEFT JOIN ".$prefix."namemap ON ".$prefix."summary.info_hash = ".$prefix."namemap.info_hash $where ORDER BY ".$prefix."namemap.filename LIMIT 0,${GLOBALS['indexpagelimitspecify']}";
|
|
| 245 |
+ else |
|
| 246 |
+ {
|
|
| 247 |
+ if ($_GET["page_number"] <= 0) //account for possible negative number entry by user |
|
| 248 |
+ $_GET["page_number"] = 1; |
|
| 249 |
+ |
|
| 250 |
+ $page_limit = ($_GET["page_number"] - 1) * ($GLOBALS['indexpagelimitspecify']); |
|
| 251 |
+ $query = "SELECT ".$prefix."summary.info_hash, ".$prefix."summary.seeds, ".$prefix."summary.leechers, ".$prefix."summary.finished, ".$prefix."summary.dlbytes, ".$prefix."namemap.filename, ".$prefix."namemap.url, ".$prefix."namemap.size, ".$prefix."summary.speed FROM ".$prefix."summary LEFT JOIN ".$prefix."namemap ON ".$prefix."summary.info_hash = ".$prefix."namemap.info_hash $where ORDER BY ".$prefix."namemap.filename LIMIT $page_limit,${GLOBALS['indexpagelimitspecify']}";
|
|
| 252 |
+ } |
|
| 253 |
+} |
|
| 254 |
+ |
|
| 255 |
+if ($GLOBALS["customtitle"] == "true") |
|
| 256 |
+{
|
|
| 257 |
+ if (!isset($_GET["page_number"])) |
|
| 258 |
+ $query = "SELECT ".$prefix."summary.info_hash, ".$prefix."summary.seeds, ".$prefix."summary.leechers, ".$prefix."summary.finished, ".$prefix."summary.dlbytes, ".$prefix."namemap.title, ".$prefix."namemap.url, ".$prefix."namemap.size, ".$prefix."summary.speed, ".$prefix."namemap.filename FROM ".$prefix."summary LEFT JOIN ".$prefix."namemap ON ".$prefix."summary.info_hash = ".$prefix."namemap.info_hash $where ORDER BY ".$prefix."namemap.title LIMIT 0,${GLOBALS['indexpagelimitspecify']}";
|
|
| 259 |
+ else |
|
| 260 |
+ {
|
|
| 261 |
+ if ($_GET["page_number"] <= 0) //account for possible negative number entry by user |
|
| 262 |
+ $_GET["page_number"] = 1; |
|
| 263 |
+ |
|
| 264 |
+ $page_limit = ($_GET["page_number"] - 1) * ($GLOBALS["indexpagelimitspecify"]); |
|
| 265 |
+ $query = "SELECT ".$prefix."summary.info_hash, ".$prefix."summary.seeds, ".$prefix."summary.leechers, ".$prefix."summary.finished, ".$prefix."summary.dlbytes, ".$prefix."namemap.title, ".$prefix."namemap.url, ".$prefix."namemap.size, ".$prefix."summary.speed, ".$prefix."namemap.filename FROM ".$prefix."summary LEFT JOIN ".$prefix."namemap ON ".$prefix."summary.info_hash = ".$prefix."namemap.info_hash $where ORDER BY ".$prefix."namemap.title LIMIT $page_limit,${GLOBALS['indexpagelimitspecify']}";
|
|
| 266 |
+ } |
|
| 267 |
+} |
|
| 268 |
+ |
|
| 269 |
+$results = mysql_query($query) or die(errorMessage() . "Can't do SQL query - " . mysql_error() . "</p>"); |
|
| 270 |
+$i = 0; |
|
| 271 |
+ |
|
| 272 |
+while ($data = mysql_fetch_row($results)) {
|
|
| 273 |
+ // NULLs are such a pain at times. isset($nullvar) == false |
|
| 274 |
+ if (is_null($data[5])) |
|
| 275 |
+ $data[5] = $data[0]; |
|
| 276 |
+ if (is_null($data[6])) |
|
| 277 |
+ $data[6] = ""; |
|
| 278 |
+ if (is_null($data[7])) |
|
| 279 |
+ $data[7] = ""; |
|
| 280 |
+ if (strlen($data[5]) == 0) |
|
| 281 |
+ $data[5] = $data[0]; |
|
| 282 |
+ $myhash = $data[0]; |
|
| 283 |
+ $writeout = "row" . $i % 2; |
|
| 284 |
+ echo "<tr class=\"$writeout\">\n"; |
|
| 285 |
+ echo "\t<td>"; |
|
| 286 |
+ echo "\t<table class=\"nopadding\" border=\"0\"><tr><td valign=\"top\" align=\"left\" width=\"10%\">\n"; |
|
| 287 |
+ echo "\t<form method='post' action='torrent_functions.php'>\n"; |
|
| 288 |
+ echo "\t<input type='hidden' name='hash' value='" . $data[0] . "'/>\n"; |
|
| 289 |
+ echo "\t<input type='submit' value=' + '/></form>\n"; |
|
| 290 |
+ echo "\t</td><td valign=\"top\" align=\"left\">\n"; |
|
| 291 |
+ if (strlen($data[6]) > 0) |
|
| 292 |
+ echo "<a href=\"${data[6]}\">${data[5]}</a> - ";
|
|
| 293 |
+ else |
|
| 294 |
+ echo $data[5] . " - "; |
|
| 295 |
+ |
|
| 296 |
+if ($GLOBALS["customtitle"] == "true") |
|
| 297 |
+{
|
|
| 298 |
+ if ($hiddentracker == true) //obscure direct link to torrent, use dltorrent.php script |
|
| 299 |
+ echo "<a href=\"dltorrent.php?hash=" . $myhash . "\"> (Download Torrent)</a>"; |
|
| 300 |
+ else //just display ordinary direct link |
|
| 301 |
+ echo "<a href=\"torrents/" . rawurlencode($data[9]) . ".torrent\"> (Download Torrent)</a>"; |
|
| 302 |
+} |
|
| 303 |
+ |
|
| 304 |
+if ($GLOBALS["customtitle"] != "true") |
|
| 305 |
+{
|
|
| 306 |
+ if ($hiddentracker == true) //obscure direct link to torrent, use dltorrent.php script |
|
| 307 |
+ echo "<a href=\"dltorrent.php?hash=" . $myhash . "\"> (Download Torrent)</a>"; |
|
| 308 |
+ else //just display ordinary direct link |
|
| 309 |
+ echo "<a href=\"torrents/" . rawurlencode($data[5]) . ".torrent\"> (Download Torrent)</a>"; |
|
| 310 |
+} |
|
| 311 |
+ |
|
| 312 |
+ //Magnet link |
|
| 313 |
+ echo " <a href='"; |
|
| 314 |
+ //https://en.wikipedia.org/wiki/Magnet_URI_scheme |
|
| 315 |
+ //Base-32 encoded SHA1 hash sum |
|
| 316 |
+ echo "magnet:?xt=urn:btih:".$data[0]; |
|
| 317 |
+ //Size in bytes |
|
| 318 |
+ echo "&xl=".$data[7]; |
|
| 319 |
+ //name |
|
| 320 |
+ if ($GLOBALS["customtitle"] == "true") |
|
| 321 |
+ echo "&dn=".rawurlencode($data[9]); |
|
| 322 |
+ else echo "&dn=".rawurlencode($data[5]); |
|
| 323 |
+ //tracker url |
|
| 324 |
+ echo "&tr=".$website_url . substr($_SERVER['PHP_SELF'], 0, -9) . $announceurl; |
|
| 325 |
+ echo "'>(Magnet"; |
|
| 326 |
+ echo "<img src='images/magnet-icon.gif' border='0' class='icon' alt='Magnet Link' title='Magnet Link' />"; |
|
| 327 |
+ echo ")</a>"; |
|
| 328 |
+ |
|
| 329 |
+ echo "</td></tr>"; |
|
| 330 |
+ |
|
| 331 |
+ |
|
| 332 |
+ if (strlen($data[7]) > 0) //show file size |
|
| 333 |
+ {
|
|
| 334 |
+ echo "<tr><td> </td><td>" . bytesToString($data[7]) . "</td>"; |
|
| 335 |
+ $total_disk_usage = $total_disk_usage + $data[7]; //total up file sizes |
|
| 336 |
+ } |
|
| 337 |
+ echo "</tr></table></td>\n"; |
|
| 338 |
+ for ($j=1; $j < 4; $j++) //show seeders, leechers, and completed downloads |
|
| 339 |
+ {
|
|
| 340 |
+ echo "\t<td class=\"center\">$data[$j]</td>\n"; |
|
| 341 |
+ if ($j == 1) //add to total seeders |
|
| 342 |
+ $total_seeders = $total_seeders + $data[1]; |
|
| 343 |
+ if ($j == 2) //add to total leechers |
|
| 344 |
+ $total_leechers = $total_leechers + $data[2]; |
|
| 345 |
+ if ($j == 3) //add to completed downloads |
|
| 346 |
+ $total_downloads = $total_downloads + $data[3]; |
|
| 347 |
+ } |
|
| 348 |
+ |
|
| 349 |
+ if ($GLOBALS["countbytes"]) |
|
| 350 |
+ {
|
|
| 351 |
+ echo "\t<td class=\"center\">" . bytestoString($data[4]) . "</td>\n"; |
|
| 352 |
+ $total_bytes_transferred = $total_bytes_transferred + $data[4]; //add to total GB transferred |
|
| 353 |
+ |
|
| 354 |
+ // The SPEED column calculations. |
|
| 355 |
+ if ($data[8] <= 0) |
|
| 356 |
+ {
|
|
| 357 |
+ $speed = "0"; |
|
| 358 |
+ $total_speed = $total_speed - $data[8]; //for total speed column |
|
| 359 |
+ } |
|
| 360 |
+ else if ($data[8] > 2097152) |
|
| 361 |
+ $speed = round($data[8] / 1048576, 2) . " MB/sec"; |
|
| 362 |
+ else |
|
| 363 |
+ $speed = round($data[8] / 1024, 2) . " KB/sec"; |
|
| 364 |
+ echo "\t<td class=\"center\">$speed</td>\n"; |
|
| 365 |
+ $total_speed = $total_speed + $data[8]; //add to total speed, in bytes |
|
| 366 |
+ } |
|
| 367 |
+ echo "</tr>\n"; |
|
| 368 |
+ $i++; |
|
| 369 |
+} |
|
| 370 |
+ |
|
| 371 |
+if ($i == 0) |
|
| 372 |
+ echo "<tr class=\"row0\"><td style=\"text-align: center;\" colspan=\"6\">No torrents</td></tr>"; |
|
| 373 |
+ |
|
| 374 |
+//show totals in last row |
|
| 375 |
+echo "<tr>"; |
|
| 376 |
+echo "<th>Space Used: " . bytesToString($total_disk_usage) . "</th>"; |
|
| 377 |
+echo "<th>" . $total_seeders . "</th>"; |
|
| 378 |
+echo "<th>" . $total_leechers . "</th>"; |
|
| 379 |
+echo "<th>" . $total_downloads . "</th>"; |
|
| 380 |
+if ($GLOBALS["countbytes"]) //stop count bytes variable |
|
| 381 |
+{
|
|
| 382 |
+ echo "<th>" . bytestoString($total_bytes_transferred) . "</th>"; |
|
| 383 |
+ if ($total_speed > 2097152) |
|
| 384 |
+ echo "<th>" . round($total_speed / 1048576, 2) . " MB/sec</th>"; |
|
| 385 |
+ else |
|
| 386 |
+ echo "<th>" . round($total_speed / 1024, 2) . " KB/sec</th>"; |
|
| 387 |
+} |
|
| 388 |
+ |
|
| 389 |
+?> |
|
| 390 |
+ </tr></table></td></tr> |
|
| 391 |
+<table> |
|
| 392 |
+ <tr class="details"> |
|
| 393 |
+ <td align="left"><a href="http://www.rivetcode.com">RivetTracker</a> |
|
| 394 |
+ <?php |
|
| 395 |
+ require("version.php");
|
|
| 396 |
+ print($version); |
|
| 397 |
+ ?> |
|
| 398 |
+ </td> |
|
| 399 |
+ <td align="right"> |
|
| 400 |
+ <?php |
|
| 401 |
+ if (file_exists("legalterms.txt"))
|
|
| 402 |
+ echo "<td align=\"right\"><a href=\"legalterms.txt\">Use Policy and Terms of Service</a>"; |
|
| 403 |
+ ?> |
|
| 404 |
+ </td> |
|
| 405 |
+ </tr> |
|
| 406 |
+</table> |
|
| 407 |
+<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> |
|
| 408 |
+<h3>Notes</h3> |
|
| 409 |
+<?php |
|
| 410 |
+if ($GLOBALS["NAT"]) |
|
| 411 |
+ echo "<ul><li>This tracker does NAT checking when users connect. If you receive a probe to port 6881, it's probably this tracker.</li></ul>\n"; |
|
| 412 |
+else |
|
| 413 |
+ echo "<ul><li>NAT checking has been disabled on this tracker.</li></ul>\n"; |
|
| 414 |
+ |
|
| 415 |
+echo "<ul><li>Even if there are no seeders, the download may still work because of HTTP seeding.</li></ul>\n"; |
|
| 416 |
+ |
|
| 417 |
+if (rand(1, 10) == 1) |
|
| 418 |
+{
|
|
| 419 |
+ //10% of the time, run sanity_no_output.php to prune database and keep users fresh |
|
| 420 |
+ include("sanity_no_output.php");
|
|
| 421 |
+} |
|
| 422 |
+ |
|
| 423 |
+?> |
|
| 424 |
+</body></html> |