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

Ajax Star Rating — 2023-01-14 21:06:10 in v3 Mods Completed
Still in action, the SQL and the rounding is important - big thanks
New_Theme — 2023-01-14 20:47:51 in v3 Themes
If you wrap your inputs in a form container, you can just call that class and target any children (input fields) within, easier than manually specifying each input explicitly.

This is why its useful nesting with fieldset. You can target the entire form and utilize labels at the same time.

<fieldset>
   --- form here --
</fieldset>

So this

input[type=reset],
input[type=button],
input[type=reset],
input[type=submit] {...}

Could be

.form-group input { ... }

Nginx config — 2023-01-14 00:31:22 in v3 Support
Are you trying to convert Apache rules to be NGINX rules?
editing torrents — 2023-01-11 00:23:45 in v2.08 Support
@Lucifer - Yes you can do that, but the reason we do not do this is:

You are forced to accept a possible corrupt .torrent which introduces problems.
Torrent page will act up attempting to bdecode the corrupt file, dead page etc.
Sure you get to edit it, but is it useful to anyone when it is corrupt/not available to download?

Also a lot of code to omit if you wish to handle corrupt metafiles in
the way of enabling editing / retaining the upload regardless of its validity.

Just doesn't make a lot of sense - If this is due to corrupt database rows or files,
and this does happen, then you need to add error reporting / handling on the torrent pages in case bdecode fails etc.
Announce Debugger — 2023-01-05 05:15:27 in v3 Support
I got vouchers coming to TorrentTrader. Wrapping up now. Works beautifully! Full write from scratch. Secure as heck. Generate thousands of voucher codes. Redeem for data, features or more. AI helped speed up the function with a do/while and array checks, so its super fast!

Do let me know how that announce report goes, I've had it running for 2 weeks and tells me exactly what is going on with my announce file at all times. I dont even need to debug anymore lol

The AI code there is recommending good code, but is overriding the DB function so its really up you. Does it still work? I guess you wont know just yet lol..

Always something new with this file lol glad you resolved it. Always consult $site_config, namely the bottom section.

I automate all of this so I dont need to mess around with all of that, but having flexibility and customization is very important.

Be nice to see these values moved to database and updatable @ admincp.php using Edit in place / OnChange requests.
Announce Debugger — 2023-01-04 23:24:09 in v3 Support
Open announce.php and find:


function err($msg) {
   return benc_resp_raw("d".benc_str("failure reason").benc_str($msg)."e");
}


Replace with


function err($msg) {
   SQL_Query_exec("INSERT INTO announce_log (message, added) VALUES ('$msg', NOW())");
   return benc_resp_raw("d".benc_str("failure reason").benc_str($msg)."e");
}


Execute SQL


CREATE TABLE `announce_log` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`message` VARCHAR(255) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
`added` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
);


Now just monitor that table. It will fill up fast, but at least you know whats going on now. I assume the error reports are consistent with common problems, but its a old file so it will require some long term observation.
Format Comment — 2023-01-03 07:59:36 in v3 Support
Most welcome! Working great on the site. This old dinosaur was needing an update for a while lol

I made it only support BR tags (for line breaks), so it handles formatting quite well. All other HTML is removed (strip_tags), and parsed accordingly.

I know it had security issues previously, as HTML was never sanitized and was wide open (while I prevented with htmlspecialchars() after each call), which made no sense at all. This resolves everything.

Because I deal with so much Japanese & UTF8 encoding, this was very important.
The clean up execution time looked very slow, just some insight on what can be done to speed that up if that becomes a problem later on. Cleanup is known to be quite slow on its own.
Cleanup time @ 54,000 rows, ~850 peers - PDO transactions - Xeon E1230 V2 @ 8GB DDR4:

~45sec

Query caching, 1M JOIN buffer, MariaDB and mysqltuner.

No Penguin. Pure FreeBSD 13.1 x64 (ZFS pool, encryption ON).

function time_ago(string $datetime, DateTime $now = null, bool $full = false, string $format = null): string
{
   try {
       $ago = new DateTime($datetime);
       if ($now === null) {
           $now = new DateTime();
       }
       $diff = $now->diff($ago);
       $diff->w = floor($diff->d / 7);
       $diff->d -= $diff->w * 7;
       $string = array(
           'y' => 'year',
           'm' => 'month',
           'w' => 'week',
           'd' => 'day',
           'h' => 'hour',
           'i' => 'minute',
           's' => 'second',
       );
       foreach ($string as $k => &$v) {
           if ($diff->$k) {
               $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
           } else {
               unset($string[$k]);
           }
       }
       if (!$full) {
           $string = array_slice($string, 0, 1);
       }
       if ($format === 'detailed') {
           return $string ? implode(', ', $string) . ' ago' : 'just now';
       } else {
           return $string ? implode(' ', $string) . ' ago' : 'just now';
       }
   } catch (Exception $e) {
       // handle exception
   }
}



// Get the current time
$now = new DateTime();

// Calculate the difference between the current time and a past date, with the default format
echo time_ago('2022-01-01'); // Outputs something like "1 year, 3 months ago"

// Calculate the difference between two past dates, with the detailed format
echo time_ago('2020-01-01', '2021-01-01', true, 'detailed'); // Outputs something like "1 year, 3 months, 2 weeks, 5 days ago"

// Calculate the difference between a past date and the current time in a different timezone
$tz = new DateTimeZone('Asia/Tokyo');
$ago = new DateTime('2022-01-01', $tz);
echo time_ago($ago, $now, false, 'detailed'); // Outputs something like "1 year, 3 months ago"
Welcome aboard!

From the West Coast, I balance the other half of a lot of the old codebase and migrate newer solutions to existing code (back-porting). I carry odd history, but I am still relevant lmao.

Good to have a community member on my side of the pond. 😎
This would be better using a private/public keypair, like my announcement and messages encryption (same system).

That would be the final update to this mod. I personally abandoned this shortly after porting it back in 2020, but seeing this today.. I think its worth giving it a shot again.

Not only that.. it eliminates the GET id.. which prevents timing attacks.

What do I mean?
TT isnt written to prevent this. And several pages are vulnerable to:

?id=27+1

A generator can step that up with a simple for loop, and download the entire database in about a few seconds, and proxy a GZip compression request - alltorrents.gz - This can be done in Python in about 30 minutes.

You guys must use
intval($_GET['id'])
- it protects against this internally.
Captcha TTv3 — 2023-01-02 21:23:09 in v3 Mods in Progress
Exactly!

I found, that it never provides me the part where a function returns, or whatever else cut off. I just say "You missed the part where it returns" and it will apologize, and provide only that missing part of the solution.

2 weeks ago, it would render the ENTIRE solution all over again as many times as you asked.. never providing the final end of the solution.

Seems like they fixed that recently (thank god) lol
Captcha TTv3 — 2023-01-02 18:57:56 in v3 Mods in Progress
I used it entirely for that comment function lol I couldn't believe how much it revealed to me, things I never knew you could do.

Pretty neat, just check it over.. its prone to slight hicups, and often you have to tell it to share the missing end of the solution, but its pretty stable since its launch now.

Someone should post the bencoder and ask "What is wrong with this code?" .. lay back and amuse yourself lol
Captcha TTv3 — 2023-01-02 18:22:14 in v3 Mods in Progress
require_once 'Captcha.php' at the start of register.php should do it.
Format Comment — 2023-01-02 06:24:13 in v3 Support
Here is a back-port function that takes care of special chars, formatting, bbcode and censor all in one. I post here, because I plan to gain feedback on new things coming to this function such as:

- Filter validation
- Improved bbcode array
- Whatever else fits here

Requires: mbstring extension

This function is critical for our descriptions, so its been with years of active attention.


function format_comment(string $text, bool $utf8 = false): string {
   $bbcode = strtr($text, array_combine(array('', '', '', '', '', '', '[img]', '[/img]', '[img=', '[/img]'), array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<img src=', ' />', '<img src=', ' />')));
   $string = str_replace('  ', '  ', nl2br(mb_convert_encoding($bbcode, 'UTF-8', 'ISO-8859-1')));
   $smilies = array(':)' => 'smile.png', ':(' => 'sad.png', ';)' => 'wink.png', ':P' => 'razz.png', ':D' => 'grin.png', ':|' => 'plain.png', ':O' => 'suprise.png', ':?' => 'confused.png', '8)' => 'glasses.png', '8o' => 'eek.png', 'B)' => 'cool.png', ':-)' => 'smile-big.png', ':-(' => 'crying.png', ':-*' => 'kiss.png', 'O:-D' => 'angel.png', ':-@' => 'devilish.png', ':o)' => 'monkey.png', ':help' => 'help.png', ':love' => 'love.png', ':warn' => 'warn.png', ':bomb' => 'bomb.png', ':idea' => 'idea.png', ':bad' => 'bad.png', ':!' => 'important.png', 'brb' => 'brb.png');
   $badword = false;
   foreach ($smilies as $code => &$url) {
       $string = str_replace($code, '<img style="width:25px;height:25px;vertical-align:middle" src="/images/smilies/' . $url . '" alt="' . $code . '" title="' . $code . '" />', $string);
   }
   $r = SQL_Query_exec('SELECT word, censor FROM censor');
   foreach (mysqli_fetch_assoc($r) as $rr) {
       $badword = true;
       $string = str_replace(trim($rr['word']), '<img src="/images/censored.png" alt="Censored" title="Censored">', $string);
   }
   $encoding = $utf8 ? 'UTF-8' : 'HTML-ENTITIES';
   return mb_convert_encoding($string, $encoding, 'ISO-8859-1');
}


Usage
format_comment($row['descr'], true);



-----

This one is much better. It uses ICONV for better character encoding/detection, enable/disable HTML, support bbcode, censor and UTF8 (optional). I'll be replacing the old function (above) with this function.

Requires: iconv + mbstring extensions

UPDATED Jan/15/23


function format_comment(string $text, bool $utf8 = false, $html = false): mixed {
   $encoding = mb_detect_encoding($text);
   if ($encoding !== 'UTF-8') {
       $string = iconv($encoding, 'UTF-8', $text);
   }
   $bbcode = strtr($text, array_combine(array('', '', '', '', '', '', '[img]', '[/img]', '[img=', '[/img]'), array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<img src=', ' />', '<img src=', ' />')));
   $string = preg_replace('/\r\n|\r|\n/', '<br>', $bbcode, -1, $count);
   if ($count === 0) {
       $string = strip_tags($string, '<br>');
   }
   $smilies = array(':)' => 'smile.png', ':(' => 'sad.png', ';)' => 'wink.png', ':P' => 'razz.png', ':D' => 'grin.png', ':|' => 'plain.png', ':O' => 'suprise.png', ':?' => 'confused.png', '8)' => 'glasses.png', '8o' => 'eek.png', 'B)' => 'cool.png', ':-)' => 'smile-big.png', ':-(' => 'crying.png', ':-*' => 'kiss.png', 'O:-D' => 'angel.png', ':-@' => 'devilish.png', ':o)' => 'monkey.png', ':help' => 'help.png', ':love' => 'love.png', ':warn' => 'warn.png', ':bomb' => 'bomb.png', ':idea' => 'idea.png', ':bad' => 'bad.png', ':!' => 'important.png', 'brb' => 'brb.png');
   foreach ($smilies as $code => &$url) {
       $string = str_replace($code, '<img style="width:25px;height:25px;vertical-align:middle" src="/images/smilies/' . $url . '" alt="' . $code . '" title="' . $code . '" />', $string);
   }
   $result = SQL_Query_exec('SELECT word, censor FROM censor');
   $censoredWords = mysqli_fetch_all($result, MYSQLI_ASSOC);
   foreach ($censoredWords as $rr) {
       $string = str_replace(trim($rr['word']), '<img src="/images/censored.png" alt="Censored" title="Censored">', $string);
   }
   if ($utf8) {
       $string = iconv('UTF-8', 'ISO-8859-1//IGNORE', $string);
   } else {
       $string = mb_convert_encoding($string, 'HTML-ENTITIES', 'ISO-8859-1');
   }
   if (strlen($string) > 0) {
       return $string;
   }
   return false;
}


Usage
format_comment($row['descr'], false, true);



if ($text = format_comment($descr, false, true)) {
   echo $text;
} else {
   echo 'Unable to convert charset.';
}


NOTE:
mysql_fetch_all caches the table, that way its not being hit with tons of requests for just a censor image. Eliminates unnecessary computations (just use PDO lol)
Captcha TTv3 — 2023-01-02 05:23:47 in v3 Mods in Progress
And I'll explain.

At every given moment, you and your host are slammed by massive TCP requests consisting of brute-force attempts on most common ports. We all are. I personally see
my logs every day and its pretty bad.

Your host takes care of most of this, but your signup page wont.

What this means, is if you can not figure out the captcha for some reason, I highly recommend enforcing a image upload (user picture or icon w/e) for the user to select, and finish form to register. This prevents bots from throwing commands, trying different file types and doing that really all day long maliciously.

Let me know what direction you wish to take, I can code either one.. I'm just super lost in this particular thread.
Captcha TTv3 — 2023-01-01 20:51:51 in v3 Mods in Progress
If this doesnt work out, force image upload (like a Avatar) and validate the heck out of the file before accepting. This will throw bots in the garbage.
error message — 2022-12-31 18:26:20 in General Chat
Actually that looks beyond complicated but I can only assume the photo is cut off. Best of luck!
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