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
User Posts

Go to Profile

Get forum post id — 2022-11-09 00:53:25 in General Chat
A way to link a new post with use of a ID (linking another post). This is actually quite useful, as you can live-render the linked post and insert it to a preview body on the fly
V3 is the entire reason I am online (and 2.08 before that). I feel I walked off the plank a bit, while I told myself I would never forget my roots and would try to maintain it best I could.

Keep in mind, my index as it stands.. as originally (mostly visually the same) was on V3 long ago, we used to use torrenttrable() for our template! Times have certainly changed lol.

My next mods will require a PEM encoded (X509 certificate) and private key with a valid passphrase. This is the same means of encryption we use in announce & torrent signing.

Its time V3  gets a push forward.

https://www.bittorrent.org/beps/bep_0012.html

Open download.php and find


$dict['announce'] = sprintf($site_config["PASSKEYURL"], $CURUSER["passkey"]);
unset($dict['announce-list']);


Replace with:


$dict = bep12_MultiTrackerExtension($dict, $CURUSER['passkey']);


Open backend/functions.php and add


function bep12_MultiTrackerExtension(array $dict, string $passkey, string $url = '', string $url2 = '', string $url3 = '')
{
   global $site_config;
   if (strlen($url) > 0) {
       $dict['announce-list'] = array(
           1 => array(
               sprintf($site_config['PASSKEYURL'], $passkey)
           ),
           2 => array(
               $url,
               $url2,
               $url3
           )
       );
       shuffle(array_merge($dict, $dict['announce-list']));
       unset($dict['announce']);
   } else if (strlen($url) === 0) {
       unset($dict['announce-list']);
       $dict['announce'] = sprintf($site_config['PASSKEYURL'], $passkey);
   }
   return $dict;
}


Example usage:


bep12_MultiTrackerExtension($dict, $CURUSER['passkey'], 'url1' 'url2', 'url3');


Use the default replacement to use only primary announce url.
Help — 2022-11-03 15:54:16 in General Chat

<?
$self = null;
if (!$res) return;
$res = SQL_Query_exec("SELECT $peerfields FROM peers WHERE $selfwhere");
$row = mysqli_fetch_assoc($res);
if (!empty($row)) {
   $self = $row;
}


But it all needs a lot of validation across the full code lol
"done" is not a global reserved name, so escaping is pointless. You would need to do this for `key` for example if the column was named that.

Sounds like too many conditions and its giving up on the last condition (done).

I would take the CPU off of the query a bit and conditionalize the block in PHP first, then call the query. Relying on 5 AND clauses sounds like trouble and implies lack of checking on  those variables. Do a SELECT and read them first, then perform the UPDATE on the validated rows/columns.



Help — 2022-11-01 03:08:55 in General Chat
Assign a z-index value to the input and send it to front. Also, apply position: relative to the forms container.

If the containing markup does not have a display: none property, then there is no reason the button shouldn’t show up. I see no element class or id so we can rule out CSS overriding the style properties.

Help needed — 2022-10-31 22:11:48 in General Chat
@Sal2azz

You appear to misunderstand how cleanup works with stale peers. Typically this table should be dynamically updated/replaced/deleted on demand with foreign keys using ONUPDATE/ONDELETE as needed but we have cleanup that just inherits every global task crammed altogether (which is pretty bad design. It is supposed to be incremental tasks, not a full blown asynchronous operation in parallel).

Should we consult this cleanup script again?
Help needed — 2022-10-31 22:04:34 in General Chat
Peer caching? What is the purpose of that? The name implies that peers will be cached for x amount of time.

If this is the case, where are bytes and other parameters being picked up if the peers state is in fact cached?

Does this not cause an out of sync issue with the peer data?

Lastly, this may cause a redundancy problem, as  most data in that table is volatile by design (with the exception of info hash and a few other fields).

Just curious.
SWT Parser — 2022-10-20 06:45:40 in Downloads & Updates
Something I'm working on, on the PHP side. This is using named captures just like implemented in my C# parser. This parses my new format.

Much like my client, it parses line by line - (read or write) - and dumps all data to a string[] and works with the data appropriately.

I dont see encryption as necessary. If the file changes, the server and client performs a deep integrity check on the SWT file to ensure it is a exact snapshot. These are created in the client, so a original snapshot is stored in database for validation if the file is modified. Why hide? This is an age of open source data.

Nothing says we can't allow that functionally in a later version supporting a private key generated within the client. Its quite easy.

PHP 5.1+

Movie2022.swt

name: Mario Kart 8 Deluxe + Update 2.0.0 + DLC [NSP]
size: 7929800387
hash: 5FEC54A804462266E4EFDFFAEEAD677C
Files("Mario Kart 8 Deluxe [0100152000022000][v0].nsp", 7268474425, "Mario Kart 8 Deluxe [0100152000022800][v720896].nsp", 661204928, "Mario Kart 8 Deluxe [DLC Booster Course Pass][0100152000023001][v0].nsp", 121034)
date: 2022-10-12 10:39:50 AM



<?
/*
*    SWT File Parser Class - Oct 25, 2022 - v1.02
*
*/
interface Parse
{
   public function openFile(string $file): array;
}
class SWTParsing implements Parse
{
   private function parseField(string $field): string
   {
       return trim(substr($field, (strrpos($field, ':') ?: -1) + 1));
   }
   private function parseFileList(string $field): array
   {
       $pattern = stripslashes(preg_match_all('/(?:\w+\(\h*|(?<!\A)\G\h*,\h*)"(?<filename>[^"]+)"\h*,\h*(?<filesize>\d+)/', $field, $m));
       if ($pattern) {
           return array_combine($m['filename'], $m['filesize']);
       }
   }
   public function openFile(string $filename): array
   {
       $metadata = array();
       $fileData = function($data)
       {
           $file = fopen($data, 'r');
           if (!$file)
               return;
           while (($line = fgets($file)) !== false) {
               yield $line;
           }
           fclose($file);
       };
       $i        = 0;
       foreach ($fileData($filename) as $line) {
           $i++;
           if ($i === 1) {
               $metadata['name'] = $this->parseField($line);
           }
           if ($i === 2) {
               $metadata['size'] = $this->parseField($line);
           }
           if ($i === 3) {
               $metadata['hash'] = $this->parseField($line);
           }
           if ($i === 4) {
               $metadata['files'] = $this->parseFileList($line);
           }
           if ($i === 5) {
               $metadata['date'] = $line;
           }
       }
       return $metadata;
   }
}



Array
(
   [name] => Mario Kart 8 Deluxe + Update 2.0.0 + DLC [NSP]
   [size] => 7929800387
   [hash] => 5FEC54A804462266E4EFDFFAEEAD677C
   [files] => Array
       (
           [Mario Kart 8 Deluxe [0100152000022000][v0].nsp] => 7268474425
           [Mario Kart 8 Deluxe [0100152000022800][v720896].nsp] => 661204928
           [Mario Kart 8 Deluxe [DLC Booster Course Pass][0100152000023001][v0].nsp] => 121034
       )
   [date] => date: 2022-10-12 10:39:50 AM
)


Improvements will be updated near daily as it evolves.

Next update
    Individual file hashes in file array

    Improved loop containing switch/break

    Extended metadata

    Source info - Url data fetch - validate root hash

General calculation when dealing with progressbars (on anything):

Tracking downloads or file operations?
long bytesCompleted = 0;
int calc = bytesCompleted / bytesDownloaded * 100;

Lacking data but have a changing variable?

long bytesCompleted = 0;
int calc = BytesCompleted / 1024 / 1024;

Ive used both extensivly in windows. It works fine. Good info to know. Adjust to your task.
Can you add those flags to a array white list? Thats a good point.
That converter is begging to read /uploads/images/* in a batch process.

I'll tinker with this and read the php.net docs

WebP appears to be supported since PHP 7.1
StyleSheet Name — 2022-10-16 22:00:24 in v3 Support
Glad it is working! Cheers  😎
All torrents is red — 2022-10-16 16:59:18 in General Chat
I could technically test the file but the code is awful, the logic of that announce file is designed like a central fold.

Meaning, the first section and last section of announce join together at the middle in a way that almost bends outward like folding a page of paper. It’s a bad design.

This is my flow on my announce:

Announce url > Check/Assign Keys > Check port/IP > Handle specific keys > Get user data from db : passkey/token > Get torrent data : token (encrypted) substr magic + decrypt > check stuff like free days, data usage, uploaded etc > peer row empty? INSERT else UPDATE > add peers to array, loop the array and handle the peer data (inet_pton / hex2bin / extensions) > check compact key + numwant > echo bencoded peers array.

I’m that order. More is going on like updating stats and other things but that’s the bulk of it.
All torrents is red — 2022-10-16 16:39:25 in General Chat
I have a trick that shows me where issues are in a file.

I added this every 5  or 10 lines starting from bottom

echo “test”;

You move that upwards in the file (from bottom) and the moment you get no echo, you found a fault.

Now comment out that first echo, add one after the bad code, fix the bad code (or just replace) and if you see that second echo .. you just fixed a snag. Move on and repeat this for all sections of the file.

I do this for any programming language if I know how the parser scans the code.

It’s important to know that PHP “looks ahead” and sort of caches a preview of all upcoming variables, global and other bits.

This is why it knows a parsing error well ahead of time beyond the line you are working within.
CloudFlare — 2022-10-16 07:12:31 in M-BiTsy Support
better:

/**
* Gets, validates and returns the connecting client's IP
*/
function getClientIP(){

   // Get real visitor IP behind CloudFlare network
   if (!empty($_SERVER["HTTP_CF_CONNECTING_IP"]) && validateIP($_SERVER['HTTP_CF_CONNECTING_IP'])) {
       return $_SERVER["HTTP_CF_CONNECTING_IP"];
   }

   // Get real visitor IP behind NGINX proxy - https://easyengine.io/tutorials/nginx/forwarding-visitors-real-ip/
   if (!empty($_SERVER["HTTP_X_REAL_IP"]) && validateIP($_SERVER['HTTP_X_REAL_IP'])) {
       return $_SERVER["HTTP_X_REAL_IP"];
   }

   // Check for shared Internet/ISP IP
   if (!empty($_SERVER['HTTP_CLIENT_IP']) && validateIP($_SERVER['HTTP_CLIENT_IP'])) {
       return $_SERVER['HTTP_CLIENT_IP'];
   }

   // Check for IP addresses passing through proxies
   if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {

       // Check if multiple IP addresses exist in var
       if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) {
           $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
           foreach ($iplist as $ip) {
               if (validateIP($ip))
                   return $ip;
           }
       }
       else {
           if (validateIP($_SERVER['HTTP_X_FORWARDED_FOR']))
               return $_SERVER['HTTP_X_FORWARDED_FOR'];
       }
   }

   if (!empty($_SERVER['HTTP_X_FORWARDED']) && validateIP($_SERVER['HTTP_X_FORWARDED']))
       return $_SERVER['HTTP_X_FORWARDED'];

   if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && validateIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
       return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];

   if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && validateIP($_SERVER['HTTP_FORWARDED_FOR']))
       return $_SERVER['HTTP_FORWARDED_FOR'];

   if (!empty($_SERVER['HTTP_FORWARDED']) && validateIP($_SERVER['HTTP_FORWARDED']))
       return $_SERVER['HTTP_FORWARDED'];

   // Return unreliable IP address since all else failed
   return $_SERVER['REMOTE_ADDR'];
}

/**
* Ensures an IP address is both a valid IP address and does not fall within
* a private network range.
*/
function validateIP($ip) {

   if (strtolower($ip) === 'unknown')
       return false;

   // Generate IPv4 network address
   $ip = ip2long($ip);

   // Do additional filtering on IP
   if(!filter_var($ip, FILTER_VALIDATE_IP))
       return false;

   // If the IP address is set and not equivalent to 255.255.255.255
   if ($ip !== false && $ip !== -1) {

       // Make sure to get unsigned long representation of IP address
       // due to discrepancies between 32 and 64 bit OSes and
       // signed numbers (ints default to signed in PHP)
       $ip = sprintf('%u', $ip);

       // Do private network range checking
       if ($ip >= 0 && $ip <= 50331647)
           return false;
       if ($ip >= 167772160 && $ip <= 184549375)
           return false;
       if ($ip >= 2130706432 && $ip <= 2147483647)
           return false;
       if ($ip >= 2851995648 && $ip <= 2852061183)
           return false;
       if ($ip >= 2886729728 && $ip <= 2887778303)
           return false;
       if ($ip >= 3221225984 && $ip <= 3221226239)
           return false;
       if ($ip >= 3232235520 && $ip <= 3232301055)
           return false;
       if ($ip >= 4294967040)
           return false;
   }
   return true;
}
All torrents is red — 2022-10-16 05:28:42 in General Chat
What was the magic fix? My torrents are still trashed. Only ones that work are webseeds (where people are going lol).
All torrents is red — 2022-10-07 16:31:04 in General Chat
"Lack of troubleshooting skills on this script" is correct, but we never think about that because we love to help. Who really knows the most? Impossible.

Are you still having issues? I looked over the script yesterday and I see a lot of old stock code, and nothing stood out in the way of attention so if it worked before, then I would rely on  it now. It must be a port issue in your internal network configuration.
Thank you!
StyleSheet Name — 2022-10-04 22:20:49 in v3 Support
Its not catching $StyleSheet variable. Move that variable before the query.

Each line in PHP is parsed with the data collected from position 0 - current line. Which means, ensure your variables are initialized and hold default values or it will never see them at current position.
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: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728