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

That is the problem with separated projects. I had a slot of skill to bring (you all know this) but no one was interested and wanted to keep things stuck in time. This is very bad for the evolution of PHP and security in general.

So I made my own project and its running stellar as we speak. What was I supposed to do?

After darkmaster offered me the site, I dont think I accepted and certainly didnt want to pay the license renewal, which was the reason for the change in the first place, it was too expensive for the key.

Suddenly it went to somebody else without mention, and from there it degraded over time. This took the project of TorrentTrader too far back in time, that it never saw the light of day. And now its practically abandoned except for the hosting fees which just comes off of someone's credit card automatically, so it doesnt really matter.

Take my advice, and just keep learning and do your best to evolve your trackers, because you'll be holding your breath otherwise.

There are people around that keep things from kindling out completely, which is respectable but it isn't allowing much more than that to prosper and progress.

Good luck. I am here much less these days, as there is just nothing happening here.
error sql — 2023-10-09 21:36:21 in v3 Support
instanceof Countable

Modern, but probably faster or concise:


if (is_array($updateset) && !empty($updateset)) {
       $updatesString = implode(',', $updateset);
       SQL_Query_exec("UPDATE torrents SET $updatesString WHERE id=$torrentid");
}


Now, this

is_array($updateset)

Unless you are initializing $upsetset to NULL, empty string or BOOL you dont need to to explicitly check for array or not. If you simply initialize with a empty array, then all you need to do is check array length (count(&array) or array_count_values(&array).

It really depends on the scope accessibility { ... }  this is a classic example of initializing ahead of time.


$bool = false;
if (true) {
   $bool = myDbFunc('SELECT column FROM table');
}

if ($bool) {
   // Because we defined $bool already we have conditional access here
}


If you point $bool to NULL or empty string, then you need to check this variable for array, string, int, etc.

In reality, you can just use empty() for checking array or strings instead of count (count is known to be slower on many elements), but does not handle undefined - so you typically check with isset() first, then carry on to other checks.

---

C programming will crucify people over this. It is so strict its almost bootcamp. PHP is built on C programming, so you can imagine how loose it is for the PHP interpreter to "guess" what type the variable is. This is why they issued table functions to deal with different scenarios, and take the guess work off of the compiler.

I dont know how they do it but its loose as hell.


Forced site cleaning — 2023-10-06 18:48:20 in v3 Support
Instead of $now (depending on how timezones are treated) you should use NOW() in place of $now, or for compatibility across different engines, use CURRENT_TIMESTAMP
Its easy to do if spaghetti code was not fore front, which maintains the primary reason for not a lot progressing on this version.

The problem you will face is difficulty in maintaining this script as its about 12 years old. This makes this even harder on somebody learning the code or even somebody who knows a "bit of PHP code", because not only will it barely be PHP 7x compatible, but it will never run on PHP 8x and just screams abrupt "rewrite it", which I had to do to keep ahead of the hobby/endeavors. This now means you need education on the last 3 major releases by PHP team, and why they matter. This is extremely time consuming and counter-productive in effort to host a simple tracker.

Dont put a lot of energy into this as it was last officially updated in 2012 from original coders, and it has been frozen in time.

Use the newer MVC version or write your own if you have the skill. The second option always wins and allows you full support and extensibility.

I could write the solution for you right now. But I dont want to hassle with slow and obscure functions and logic that just makes it way more complicated than it even should be - we are not reinventing WordPress lol - its a simply bittorrent tracker that stores GET requests from the client. Nothing special at all. This is why MySQL is such a deal around here - because its the holy grail of tracker data and sustainability - without that, the tracker is a bag of rusty nails with a design on the bag.



Its because your not wrapping $msg_shout properly in the SQL. Your escaping to allow variable, but not enclosing it between ticks '


$image = $inames[0];
$msg_shout = sprintf(
   '[img]%s/images/Torrents/NouveauTorrent.png[/img]\n[url=%s/torrents-details.php?id=%d]%s[/url]\r[img1]%s/uploads/images/%s[/img1]\n%s',
   $site_config['SITEURL'],
   $site_config['SITEURL'],
   $id,
   $torrent,
   $site_config['SITEURL'],
   $image,
   ($anon == 'no' ? sprintf('Par [url=%s/account-details.php?id=%d]%s[/url]\n', $site_config['SITEURL'], $CURUSER['id'], $CURUSER['username']) : '')
);
$date_time = get_date_time();
SQL_Query_exec("INSERT INTO ajshoutbox (uid, date, name, text) VALUES(0,'$date_time', 'Robot Crazy' , '$msg_shout.')");
$id = mysqli_insert_id($GLOBALS['DBconnector']);


Also, since the tick issue and due to the use of the legacy sqlesc() function, this makes more sense

function param(string|int $param, bool $throw = false): string|int
{
    // Configurable, in case SQL field has ALLOW NULL
    if ($throw && empty($param)) {
         throw new \Exception('Missing SQL param: empty.');
    }
    $param = htmlspecialchars($param, ENT_QUOTES, 'UTF-8');
    return is_string($param) ? "'{$param}'" : (int) $param;
}

SQL_Query_exec("INSERT INTO ajshoutbox (uid, date, name, text) VALUES(0, " . param($date_time) . ", 'Robot Crazy' , " . param($msg_shout));
seed bonus — 2023-09-28 20:05:16 in v3 Support
I tried to implement 4 mods to torrenttable() (backend/functions.php) and the code is just so aged so I had to discontinue. The code efficiency is just so low that it would introduce addition errors and problems before seeing the mods actually working.

I think any work I do forward, must go through my strict short-hand style of coding. My own codebase follows this, while I dont line up to true PSR spec, I do lean beside a close definition strict=1, but not quite yet.

This makes modifying TTv3 difficult when I ported out. While some things are the same internally, most of rewritten.

The mods to be added:
- Torrent Table: Seeders Speed Score (icon, 4 colors in total - admincp configurable)
- Live torrent stats w/ interval refresh - admincp configurable
- Move seeders/leechers stats reading to read peers table (live)
- Torrent signing - torrents-upload.php - admincp configurable (w/ cert creation)

First is first - remove this bencode library and manual dictionaries, and parse torrent data using a better library, etc
Progress — 2023-09-17 19:00:17 in M-BiTsy Support
Does it include a bencode/bdecode library? If so, announce needs serious work. Its just flat out basic in a static sense. If you need help implementing BEP standards, let me know.

For example - /public_html/announce.php


// Get Peer
$peer = pdo($pdo, "SELECT seeder, UNIX_TIMESTAMP(last_action) AS ez, peer_id, ip, port, uploaded, downloaded, userid, passkey FROM peers WHERE torrent = ? AND peer_id = ? AND passkey = ? AND event != 'paused'", [$torrent['id'], $client['peer_id'], $client['passkey']])->fetch(PDO::FETCH_ASSOC);


Added:

AND event != 'paused'


Requires peers.events
ENUM: 'started','stopped','paused','completed' (default: 'started')

Now it allows ignoring paused peers, as well as other events.

Handling the paused event:

if ($client['event'] === 'paused') {
    pdo($pdo, "UPDATE peers SET event = 'paused' WHERE peer_id = ?", [$client['peer_id']]);
}


Repeat this code for all events (started, stopped, paused, completed) - same idea.

Thats just the pause event. There about 11 other features missing from announce.php alone, and no correct library in use that deals with big integer math and other features (like resource streams for example)
seed bonus — 2023-09-16 16:44:26 in v3 Support
This is my final beta - its working very well. Quite interactive, all stats update automatically every 10 seconds, seeders history every 15 seconds (or on transaction complete). 3 days of javascript, PHP and SQL testing

https://i.imgur.com/PpA6MGt.jpg
seed bonus — 2023-09-15 16:16:57 in v3 Support
Its never been perfect. The original mod, just sent bytes to 'uploaded' as to prevent cleanup from banning people. Im still deciding on this, as I have enough events stimulating upload credit.

All the original mod did was count # of torrents seeding (peer table). What it did not do was use max() to avoid negative overflows. Also, it did not consider 'seeding time' on top of seeding count.

I use a calculation for this now.
seed bonus — 2023-09-14 21:18:18 in v3 Support
I'll put together a ZIP but some SQL will have to be edited for user / torrent. the rest of it reads the old 'bonus' table and the defaults as normal.

The seedbox calc function -


private function CalcSeedBonus(int $torrentId, string $lastAnnounce, int $completed): float
{
$currentTime = time();
$lastAnnounceTime = strtotime($lastAnnounce);
$timeDifference = $currentTime - $lastAnnounceTime;

if ($completed == 1) {
$seedBonus = $this->baseSeedBonus + ($timeDifference * $this->timeMultiplier);
} else {
$seedBonus = 0;
}

return $seedBonus;
}
seed bonus — 2023-09-14 16:19:54 in v3 Support
I was using this for over 2 years, and also same complaints. I have replaced it with a new system, that also counts seeding 'time' not just 'count' and coded the entire thing from scratch, importing the bonus code into a primary endpoint - its completely AJAX-driven.

https://i.imgur.com/Jy127Vx.jpg

Sometimes you just have to pull out pen and paper, sketch out what you want.. and start typing it out into reality.

Hung onto the old TTv3 "Seed Bonus" page as long as possible, and it served for years but people want more - and the store was born.

---

Anyone interested in the new calculation function, PM me and I will send it over with instructions.

That depends how your expecting output. Your display raw string from table row, but your not wrapping it with for example - format_comment()

Use the function you have responsible for bbcode, and be sure to wrap the expecting variable to parse the bbcode.
Enchanced Requests — 2023-09-11 16:48:52 in v3 Mods Completed
Its very messy, most code I review on here is messy and buggy - all part of learning!
Enchanced Requests — 2023-09-09 17:15:10 in v3 Mods Completed

$poster = (isset($pic) ? $pic : "");
$poster = sqlesc($poster);
$userid = sqlesc($userid);
$request = sqlesc($request);
$descr = sqlesc(htmlentities($descr)); //  <-----
$cat = sqlesc($cat);

SQL_Query_exec("INSERT INTO requests (hits, userid, cat, request, descr, poster, added) VALUES(1, $CURUSER[id], $cat, $request, $descr, $poster, '" . get_date_time() . "')");
$id = mysqli_insert_id($GLOBALS["DBconnector"]);


Also, preg_match can be replaced with better ways and greater efficiency using a predefined filter array. Currently Its not checking MIME, header data or filesize. This can be quite vulnerable at a first glance. That is just image insertion.

Someone should audit this file if they have the time.
banned download — 2023-09-08 19:20:03 in v3 Mods Requests
The code is wrong, because it is using division against a float value. None of that makes sense in the context of INT / FLOAT.

I actually need this code, so I will post a working copy that is fast.
Enchanced Requests — 2023-09-08 19:16:47 in v3 Mods Completed
You should never ever see a image in a exception message. Inserting raw input without handling, can crash the table and cause data loss among other problems.

INSERT : htmlentities($string)

READ: html_entity_decode($string)
Where is VALUES ( ... ) ?

INSERT needs field and value parameters set.
Try inserting strings with htmlentities($string), and see if the error still occurs.
This conflicts with external. The lack of the private key in general should be a clear indication that the metadata is publicly tracked. Always perform this check before inserting a new key into the info dictionary.
Often with COUNT(x) it will limit the result set, maybe this is why there is grouping taking place, but its best to use a sub query for these things

SELECT (SELECT COUNT(id) FROM users WHERE ip = u.ip LIMIT 1) as count FROM users u ...

Also, be sure to do COUNT() on a primary key (index) so its fast. Otherwise, using the asterisk character on a large user table will be inefficient since it is pulling all columns regardless of needing say.. 2 or 3 in the result set.

The same applies for torrent table. Make lookups/counts fast as much as possible.
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728