Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[HACK] URL ANNOUNCE+PASSKEY
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2020-02-27 09:31:42
With url after having added to your client url of annouce with ca passkey, its will allow you to share the promise.


to have the passkey at the end of the url on torrents-upload :

Search:
[php]
print ("<tr><td align='right' valign='top'>" . T_("ANNOUNCE_URL") . ": </td><td align='left'>");

while (list($key,$value) = thisEach($announce_urls)) {
   echo "<b>$value</b><br />";
}
[/php]

Replace for:

// Displaying the Ad URL              
print ("<tr><td align='center' valign='top' colspan='5' valign='top'><br/><font color='Orange'>" .T_("ANNOUNCE_URL"). "</font>: ");
while (list($key,$value) = thisEach($announce_urls)) {
   echo "<font color='AliceBlue' size='3'>".$value."?passkey=".$CURUSER['passkey']."</font><br/><br/>";
}
// End

2020-02-27 10:34:28
If you don't want to deal with the unknown with the passkey system, and lack of FAQ on this matter specific to TT, you can simply achieve it reliably this way. This opens the door for AJAX automatic announce updates (like regenerating new passkeys with a button for user), including peers and seeds. Got tired of this so I made a solution, I needed this working.

Open torrents-upload.php and find:

if (!in_array($announce, $announce_urls, 1)) {
           $external = 'yes';
       } else {
           $external = 'no';
       }


Replace with

$external = 'yes'; // FORCE YES TO ALL UPLOADS. QUERY UPDATE TO 'OFF' IF PRIVATE & UPDATE PASSKEY (SHA1 COMING SOON) - torrents-details.php


Your just forcing external at all times. Next, open torrents-details.php and find

$row = mysql_fetch_assoc($res);


After that, add:

// Condition: ALL torrents are now external by default on upload.
// Fix: Detect if torrent is external, match table url to private announce ($announce), generate passkey, update table - Feb 26, 2020

if ($row["external"] = 'yes' && $CURUSER["control_panel"]=="yes") { // Admin only

   $matches = [];
   $generatekey = substr(md5($row['name']), 17, 20);  // Generate 15 char passkey. String cut twice, decoding difficult.
   $announce = $site_config['announce_list'] . '?passkey=' . $generatekey;
   if (preg_match('{^http://[\w\.]*website.com/}i', $row["announce"], $matches)) {
      SQL_Query_exec("UPDATE torrents SET external='no', announce=" . sqlesc($announce) . " WHERE id=$id");
      SQL_Query_exec("UPDATE users SET passkey=" . sqlesc($generatekey) . " WHERE id=$CURUSER[id]");
   }
}


Change website.com to your real domain. I didn't optimize much of this, it can be better. I see 2 areas that could be improved.

Now when a user visits a private torrent, but the torrents-upload.php failed to take action, passkey all that mess.. this just does it for you on first/only page load.
2020-02-27 18:15:33
"STorrents2020, post: 68021, member: 20382":

$row = mysqli_fetch_assoc($res);

thank you one more addition to this hack
2020-02-27 22:27:07
"spiritblue, post: 68023, member: 401":

thank you one more addition to this hack


That isn't an addition, that is default TT code that should always remain in torrents-details.php, I instruct to add code under due to how it queries SQL first, any position before that fails to retrieve $row.
2020-02-27 22:31:55
"STorrents2020, post: 68024, member: 20382":

That isn't an addition, that is default TT code that should always remain in torrents-details.php, I instruct to add code under due to how it queries SQL first, any position before that fails to retrieve $row.

ok, but with me external is not use
2020-02-27 22:36:04
If you are only private tracking torrents (your own announce strictly), then this mod won't do much. You can still modify it to update tables without the check by removing


if ($row["external"] = 'yes' && $CURUSER["control_panel"]=="yes") {
// Keep all this code inside
}


I dont trust external="no", it never seems to work. I would use != "yes" which is the opposite, much like a negative value in css, same idea.
2020-02-28 05:43:13
And I do like so to detect the cases for the announce url


// Detect Public/Private trackers - Fixed - Feb 27, 2020
$matches = [];  
if ($row["external"] = 'yes' && !preg_match('{^http://[\w\.]*website.com/}i', $row["announce"], $matches)) {
   print("<p>Public Tracker <span style='color:#C0C0C0;padding-left:10px'>" . htmlspecialchars($row['announce']) . "</span></p>");
}
if ($row["external"] = 'no' && $CURUSER && preg_match('{^http://[\w\.]*switch-torrents.com/}i', $row["announce"], $matches)) {
   print("<p><img src='/images/q_block_private.png' style='height:22px;width:22px;vertical-align:top;margin-right:7px' /> Private Tracker <br /><span style='color:#808080;padding-top:15px'>" . $row['announce'] . "</span></p>");
}
if ($row["external"] = 'no' && !$CURUSER && preg_match('{^http://[\w\.]*switch-torrents.com/}i', $row["announce"], $matches)) {
   print("<p><img src='/images/q_block_private.png' style='height:22px;width:22px;vertical-align:top;margin-right:7px;color:#C0C0C0' /> Private Tracker (<a href='" . $site_config['SITEURL'] . "/signin/?returnto=/details/$id/'>sign in</a> for access key)</p>");
}
2020-02-28 05:44:02
And I do like so to detect the cases for the announce url


// Detect Public/Private trackers - Fixed - Feb 27, 2020
$matches = [];  
if ($row["external"] = 'yes' && !preg_match('{^http://[\w\.]*website.com/}i', $row["announce"], $matches)) {
   print("<p>Public Tracker <span style='color:#C0C0C0;padding-left:10px'>" . htmlspecialchars($row['announce']) . "</span></p>");
}
if ($row["external"] = 'no' && $CURUSER && preg_match('{^http://[\w\.]*website.com/}i', $row["announce"], $matches)) {
   print("<p><img src='/images/q_block_private.png' style='height:22px;width:22px;vertical-align:top;margin-right:7px' /> Private Tracker <br /><span style='color:#808080;padding-top:15px'>" . $row['announce'] . "</span></p>");
}
if ($row["external"] = 'no' && !$CURUSER && preg_match('{^http://[\w\.]*website.com/}i', $row["announce"], $matches)) {
   print("<p><img src='/images/q_block_private.png' style='height:22px;width:22px;vertical-align:top;margin-right:7px;color:#C0C0C0' /> Private Tracker (<a href='" . $site_config['SITEURL'] . "/signin/?returnto=/details/$id/'>sign in</a> for access key)</p>");
}
2020-02-28 11:26:48
To further extend this and make friendly, add to htaccess:

RewriteEngine On
RewriteRule ^passkey\/([^/]*)$ /announce.php?passkey=$1 [L]

Which will produce: http://website.com/passkey/04178cba17a1972     <--- This passkey is just a example, you can generate any you like. In this case, we are grabbing it from the torrent.

Add this to torrents-details.php

print("<a href='" . $site_config['SITEURL'] . "/passkey/".str_replace("http://website.com/announce?passkey=", "",($row["announce"]))."'>" . $site_config['SITEURL'] . "/passkey/".str_replace("http://website.com/announce?passkey=", "",($row["announce"]))."</a>");


All of that can just be called from a variable like $passkeyurl but this is for readability. This just grabs the passkey from the torrent, and puts it into the new url. This can be extended to grab the users passkey, like website.com/user/Jenny/passkey_<PASSKEY>

If that line seems like overkill, its because its modified away from what it actually does for me, renders the passkey through GD to high res image, which is then base64 encoded. So I had to do some trickery since Apache rewrite doesn't allow http:// after a rewritten forward slash (not without some Jedi skills), so I'm stripping the full announce url, leaving only passkey and rendering it to image. So we trick it by pre-appending the url in the GD script & only pass over the passkey to the rewritten url parameter (/passkey/YOURKEY). My situation is dynamic and very self aware, due to the user volume lately but once I fully figure out this system, a mod should come under way to set up  the process for users.

Example usage: https://www.switch-torrents.com/passkey/04178cba87a1172
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728