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

All torrents is red — 2022-10-04 19:29:06 in General Chat
PM me your announce file.
Daily Login Bonus — 2022-08-11 02:21:41 in v3 Mods Completed
Why did the SQL_Exec() function never get  prepared parameters? I think part of the issue is the complexity when dealing with external calls inline with the query string itself.

I know, myself looking at that just feels overly complicated and confusing even though I know PHP.  Just a side note.

There’s still time to do this to that class.

Yes Ive done this to images too using a instagram-like border with blended colors. keyframes is great!
Error sql — 2022-08-03 19:35:16 in v3 Support
My tracker is down too, everything red. I’ll help out once I sort that out too. Gotta love bugs that comes out of non-existence.
Error sql — 2022-08-02 16:18:27 in v3 Support
This was such a famous issue, I remember always having this problem.

if ($upthis < 0) $upthis = 0;


Or

max($upthis, 0)


NOTE: max() handles arrays too.

Handle this before it ever reaches the transaction, removing any need to cast or altering the table.
Peer codez — 2022-07-30 22:12:54 in Support & Suggestions

// Get waiting peers due to maxslot queue for this torrent - July 30, 2022
function checkSlotWait(int $torrent_id)
{
   global $db;
   $waiting = $db->query_params("SELECT (SELECT COUNT(DISTINCT torrent_id) FROM peers WHERE user_id = p.user_id AND seeder = 'no') AS total_active, u.slots, u.username, u.avatar_thumb, p.torrent_id, p.seeder FROM peers p LEFT JOIN users u ON u.user_id = p.user_id WHERE u.user_id = p.user_id AND p.seeder = 'no' AND p.torrent_id = :torrent_id", array(
       'torrent_id' => $torrent_id
   ));
   foreach ($waiting->fetchAll() as $checkslotwait) {
       if (intval($checkslotwait['total_active']) > intval($checkslotwait['slots'])) {
           printf('<div>Peer waiting: <img style="vertical-align:middle;margin-left:7px;width:15px;height:15px" alt="%s" src="/%s"></div>', html_escape($checkslotwait['username']), $checkslotwait['avatar_thumb']);
       }
   }
}



checkSlotWait($row['torrent_id']);
Daily Login Bonus — 2022-07-30 06:47:10 in v3 Mods Completed
MicroMonkey:
Wouldnt you wanna change those sql queries to
`added` datetime NOT NULL,`expiry` datetime NOT NULL,
to avoid that zero date issue? I remember something like that being a problem a little bit


There is 3 ways of covering that

- add a default field value
- add IFNULL / NOT NULL in query
- handle is_null / != null on PHP side

Either of those work, but doing this on the database side is advised (earlier POC). Null checks on PHP are better used on object state & function return handling imho but it works on database fields all the same.
Daily Login Bonus — 2022-07-29 15:00:08 in v3 Mods Completed
As for shoutbox, execute a INSERT query on success to the previous checks.
Daily Login Bonus — 2022-07-29 14:58:41 in v3 Mods Completed
You just wrap this in a function and call it if cookie is stored (success) and user of is not 0 or not a INT, push it further and do a SELECT and validate user row against the User Id before proceeding to grant login bonus. I can clean this up a bit on Saturday as I want to use this too (so it needs a light update)
Need quick help, please — 2022-07-27 14:14:18 in General Chat
Radios/checkboxes are annoying to deal with and validate without JS. A link with a parameter is often better, although not as visually pleasing.
Code TidBits — 2022-07-16 23:14:30 in Support & Suggestions
Neat thing I moved from just POST + html to JSON and better handled file search within bencoded data - LONGBLOB fields by query on JS side - ajax

// AJAX Live File Search - Meta Data - July 15, 2022
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
   if (isset($_POST['meta_file_name'])) {
       $matchedfile = $db->query_params('SELECT b.torrent_id, t.name, t.cover1 FROM torrents_blob b LEFT JOIN torrents t ON t.torrent_id = b.torrent_id WHERE b.data LIKE :matched_metafile', array(
           'matched_metafile' => '%' . html_escape(trim($_POST['meta_file_name'])) . '%'
       ));
       $matched     = array();
       foreach ($matchedfile->fetchAll() as $row) {
           $data['torrent_id'] = intval($row['torrent_id']);
           $data['name']       = html_escape(trim($row['name']));
           $data['cover']      = $row['cover1'];
           array_push($matched, $data);
       }
   }
   echo empty($matched) ? json_encode(array(
       'matched' => 'false'
   )) : json_encode($matched, JSON_UNESCAPED_SLASHES);
}
Code TidBits — 2022-07-16 18:37:08 in Support & Suggestions
I'll check that out - thanks! I am completely unaware of such a thing other than SPL auto load.


<?
// BEP 39 - Updating Torrents Via Feed URL
$dict['info']['update-url'] = sprintf('%/update.php', $CONFIG['base_url']);
$dict['info']['originator'] = $certificate_DER_encoded


This matches the spec, without alternative key in encoded (optional) field (BEP 35) since we are adding the keys after openssl_sign. Now we continue to update.php to push torrent to client if torrent is depreciated/updated.

update.php

<?
// BEP 39 - Updating Torrents Via Feed URL
if (array_key_exists('info_hash', $_GET)) {
   $res = $db->query_params('SELECT b.data FROM torrents_blob b LEFT JOIN torrents t ON t.torrent_id = b.torrent_id WHERE t.info_hash = :info_hash LIMIT 1', array(
       'info_hash' => trim($_GET['info_hash'])
   ));
   if ($row = $res->fetch()) {
       http_response_code(200);
       die($row['data']);
   }
}


Now we accept GET request from uTorrent (confirmed implemented, read spec)
/update.php?info_hash=1835d21d3df92f90ccf23457b73be7b591b91fe0

Next, download.php

<?
// BEP 39 - Updating Torrents Via Feed URL
$pKey = file_get_contents('private.key');
$pKey = openssl_pkey_get_private($pKey, 'somepass');
openssl_sign(Bencode::encode($parse['info']), $signature, $pKey);
$buffer  = file_get_contents('certificate.pem');
$convert = convertToDer($buffer);
if ($convert->status === 'success') {
   $parse['info']['update-url'] = sprintf('%s/update.php', $CONFIG['base_url']);
   $parse['info']['originator'] = $convert->result;
}
Code TidBits — 2022-07-16 02:27:55 in Support & Suggestions
I use about 8 BEPs in total, maybe 10 due to the private torrents etc. All very tightly woven in place. I thank you dearly for your signing code, I would of paid money for that, easily.

—-

That’s a little what I’m doing too, only parsing /modules/* to allow extensibility to the code base.

I have a few more pages to convert to classes, and from there the module system will be implemented as well as providing the “blocks” seen on the homepage.

This kind of portability allows me to easily debug a single feature by file, and push updates fast without getting into the core of the entire site each time.

Have you developed a plug-in system before? Do you use SPL auto load for this?
Code TidBits — 2022-07-14 17:25:31 in Support & Suggestions

// Get available seed bonuse upgrades available for current user points balance
$bonus        = $db->query_params('SELECT * FROM bonus');
$getbonusinfo = $bonus->fetchAll();
$seedbonus    = $db->query_params('SELECT seedbonus FROM users WHERE user_id = :user_id LIMIT 1', array(
   'user_id' => 1
));
$current      = array(); // current points
foreach ($seedbonus->fetchAll() as $value) {
   array_push($current, floatval($value['seedbonus']));
}
foreach ($getbonusinfo as $row) {
   if ($current[0] > floatval($row['cost'])) {
       printf('You can get: %s <br>', $row['title']);
   }
}



// BEP-12 Multitracker Metadata Extension
$multitracker = array(
   'udp://tracker.com/announce1',
   'udp://tracker.com/announce2'
);
if (!empty($multitracker)) {
   $arr['announce-list'] = [['udp://tracker.com/announce1', 'udp://tracker.com/announce2'], [sprintf('%s/announce?%stoken=%s', $CONFIG['base_url'], 'v=1&', $token)]];
   shuffle($arr['announce-list']);
}



// BEP-38 Finding Local Data Via Torrent File Hints
$similar = $db->query_params("SELECT t.info_hash, c.name AS cat_name, t.name FROM torrents t LEFT JOIN categories c ON t.category = c.id WHERE t.name LIKE :match", array(
   'match' => '%' . strtok($name, ' ') . '%'
));
$hashes  = array();
foreach ($similar->fetchAll() as $row) {
   array_push($hashes, hex2bin($row['info_hash']));
   $parse['collections'] = sprintf('com.%s.%s', strtolower(strtok($row['cat_name'], ' ')), strtolower(strtok($row['name'], ' ')));
}
if (!empty($hashes)) {
   $parse['similar'] = $hashes;
}



public function verifyToken(string $passkey, string $token, string $peer_id): never
{
   $filter    = array(
       '_',
       '-',
       '[',
       ']',
       '!',
       '@',
       '$'
   );
   $getuserid = $this->query_params('SELECT u.user_id FROM peers p LEFT JOIN users u ON u.user_id = p.user_id WHERE p.chosen_peer_id = :peer_id LIMIT 1', array(
       'peer_id' => $peer_id
   ));
   foreach ($filter as $char) {
       if (strpbrk($token, $char) !== false) {
           $this->fail('Token invalid. Err(1)');
       }
   }
   if (strlen($this->decryptToken($token)) === 0) {
       if ($u = $getuserid->fetch()) {
           $this->sendNotif($u['user_id'], 'Client token is invalid.', 'Tracker');
       }
       $this->fail('Token invalid. Err(2)');
   }
   if (strpos($token, $filter[0]) !== false) {
       if ($u = $getuserid->fetch()) {
           $this->sendNotif($u['user_id'], 'Client token is invalid.', 'Tracker');
       }
       $this->fail('Token invalid. Err(3)');
   }
   if (hash_equals($this->decryptToken($token), $passkey) !== true) {
       $this->fail('Token invalid. Err(4)');
   }
}
Unconnectable — 2022-07-13 23:14:21 in v3 Support
This should be enough to cover string case


function unesc(string $x): mixed {
  return is_string($x) ? stripslashes($x) : null
}


And use like


if (unesc($str) != null) {
  // String was escape, continue...
}
Unconnectable — 2022-07-13 23:04:58 in v3 Support
return stripslashes($x);
Unconnectable — 2022-07-13 19:12:20 in v3 Support
Your asking it to return a potentially NULL or empty value, then asking again to return using a function wrap to a variable with unpredictable state.

On PHP7+ make nullable, or add is_string() check else return nothing.

function unesc(?string $x) {
  // do stuff
}
ratio moves more — 2022-07-13 03:54:23 in v3 Support
V3 is a son of a gun.

Maybe I find time this weekend and finally convert that dead horse to a new version using existing mysqli and tables/column names.

I know a lot more now since my last attempt.

I have suspicion the VPS staff are watching the connections. Who knows in this day and age. That’s against TOS at best.
Unconnectable — 2022-07-13 02:31:29 in v3 Support
This question is so large in context and possibilities. Do you have Apache logs? Can you sanitize and share a GET request to /announce.php ?
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