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

Is this mod not working? Do we need a rewrite from scratch? I got some time.
In my case, this works for me perfectly fine


// Similar torrents
$var = 'Super Mario';
$words = explode(' ', $var);
$similar = $db->query_params('SELECT * FROM torrents WHERE name LIKE :term1 AND name LIKE :term2 LIMIT 5', array(
   'term1' => '%' . $words[0] . '%',
   'term2' => '%' . end($words) . '%'
));
if ($row = $similar->fetchAll()) {
   print_r($row);
}


Using explode, we grab the first word [0], and then call end($array) for the last element. This I found, provided much better consistency with relevant titles compared to just matching a primary title or single word.
is there a primary index on forum_tg? is forum_tg the same as "id"?
Unconnectable — 2023-02-03 19:21:36 in v3 Support
Is this still happening? Why did this reboot 49 weeks later?
$_SERVER["DOCUMENT_ROOT"]

__DIR__ works too, cleaner
Its filling in parameters that are normally sent when the tracker receives a response.

Typically, its because announce shouldn't send all parameters over until the database / check conditions are met. So this is jumping ahead, and potentially missing important logic prior.

Its perfectly valid, but the url string that contains all of this is automatically generated from the client so this is unnecessary. If its seen as required, then something else is wrong in the code.
Auto promote — 2023-01-27 16:36:18 in v3 Support
Great work!

Do the forum statistics reflect this? I recommend this value be in a different field that is read separately from the forum, and written separately.

That way, you retain the organic forum statistics while eliminating dead stats, and you still satisfy the conditions.

forums.post_count = 50
rtorrent — 2023-01-27 01:10:20 in v3 Support
I would take that up with the seedbox. TorrentTrader shouldn't behave any differently.

printf('<legend><b>%s</b></legend>%s<br>%s<br>%s</fieldset></td></tr>', T_('IMDB_PLOT'), $bdhaut, $_data->Plot, $bdbas);


Easier to see whats going on.

Just count your %s to the left to match the variable responsible.
This is a fully rewritten function for Clean up file (both here and TTv3, possibly later editions).

I'll convert to MySQLi when I get the chance, unless you know what to do.

--

Edit: I will attach file instead
I think we can implement that no problem with a base set of compatible rendered characters


function format_comment(string $text): mixed
{
global $site_config;
$censor = $site_config['blacklist'];
...


'blacklist' => array('shit', 'poo', 'fckr');


I dont think you need a global, you can remove that
A shorter and fully compatible solution to UTF-8 and ISO-8859-1 descriptions/titles.

This only allows BR tags, and removes all other HTML allowing line breaks in descriptions which preserves the text presentation.

Removed:
pulling swear words from database. Unnecessary overhead when we can just read a local array.


function format_comment(string $text): mixed
{
$censor = array('ass', 'shit');
if (strlen($text) > 0) {
$text = str_ireplace($censor, '(censored)', $text);
$text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');
$string = preg_replace('/\r\n|\r|\n/', '<br>', strtr($text, array_combine(array('', '', '', '', '', '', '[img]', '[/img]', '[img=', '[/img]'), array('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<img src=', ' />', '<img src=', ' />'))), -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);
}
return $string;
}
return false;
}
It gets messy when you chain methods together which DateTime doesnt support, being a static class.

For example, you cant do this

$interval = $date_time->diff($time_ago);

Which is basically:

$now->diff(this);

I think your code is the best case.
I think is due to the string concatenation taking place in announce.php, which is not using encoding from a bencode class for some reason. I believe this produces a invalidation delay. Just bizarre.
Nginx config — 2023-01-18 01:57:19 in v3 Support
That certainly looks correct. I feel the NGINX map module is a better approach to this, but I have no idea.

rewrite ^/([^/]*)$ /index.php?url=$1 last;


Can you use the 'last' flag? Also, that regex should handle all cases.
Help with regex? — 2023-01-17 02:47:04 in v3 Support
This is what is happening with that expression

https://regex101.com/r/y86LOl/1
Help with regex? — 2023-01-16 22:06:40 in v3 Support

$string = 'http://www.imdb.com/title/tt2488496/?ref_=nv_sr_1
http://www.imdb.com/title/tt2488496/
https://www.imdb.com/title/tt2488496
imdb.com/title/tt2488496
tt2488496
imdb.com/title/season2488496
http://www.imdb.com/title/tt2488496
http://www.imdb.com/news/ni59315274
www.imdb.com/title/tt2488496/?ref_=nv_sr_1';

preg_match_all('/\/(title|news)\/(tt[0-9]+|ni[0-9]+)/', $string, $matches);
print_r($matches[2]);


Im not sure what you want to do with the array, is this to insert the IDS (loop) and send to database?

Loop is just to show how it works. You dont need foreach if the fields are named the same. You can just do

json_encode($table->fetchAll())


and it sends the column names as the JSON field names (either case, you are sending a array over to json_encode()).
SQL injection patch :) — 2023-01-16 16:28:39 in v3 Support
What you should do is prepare the statement so this isn’t possible, currently it is still insecure and is calling a super global (cookie no less) with no filtering.

This looks like a cookie injection vulnerability, possibly by accident. Maybe your still learning, that is possible.

Also, why are you directing the where clause (if) field to a cookie value? You should use the provided global $CURUSER[]: username, id, email, etc
JS:


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
let requestQueue = $.when();
function torrent_stats() {
const t_id = <?=intval($_GET['id'])?>;
requestQueue = requestQueue.then(function() {
return $.ajax({
type: 'GET',
url: '/stat.php',
dataType: 'JSON',
data: {
id: parseInt(t_id)
},
beforeSend: function() {
$('#load_ajax_error').html(data.status).hide();
$('#load_torrent_stats').html('Fetching...');
},
success: function(data) {
let html = '';
data.forEach(item => {
let html += 'Seeders: ' + item.seeders + ', Leechers: ' + item.leechers;
});
$('#load_torrent_stats').html(html);
},
error: function(data) {
$('#load_ajax_error').html(data.status).show();
}
});
});
}
torrent_stats();
setInterval(torrent_stats, 150000);
</script>

HTML

<p id="load_torrent_stats"></p>
<p id="load_ajax_error"></p>


PHP

<?php
$servername = "localhost";
$username = "dbusername";
$password = "dbpassword";
$dbname = "dbname";

try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}

$peers = $conn->prepare('SELECT seeder, leecher FROM peers WHERE torrent = :id');
$peers->execute([':id' => intval($_GET['id'])]);

$results      = array();
if ($check = $peers->fetchAll()) {
foreach ($check as $row) {
$data['seeder']  = intval($row['seeder']);
$data['leecher'] = intval($row['leecher']);
array_push($results, $data);
}
die(json_encode($results, JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK));
} else {
die(json_encode(array('seeder' => 0, 'leecher' => 0)));
}


Play with the predefined constants. Since this is dealing with 2 integers all you need to do is use JSON_NUMERIC_CHECK to be certain the array field is in fact a number and only a number.

In my case, for ratings I had to use JSON_PRESERVE_ZERO_FRACTION to preserve a value of "0.0" or else it converts it to "0" (like intval, same result). This had me stuck for 2 hours! This was necessary as we depend on a float no matter what.

----

If you want to cram lots of data into a single request, and parse it on the other end I can show you how to do that too (both JS + PHP), its become an art. You can render your entire index by reading plain text (JSON). My index is JSON that modifies existing DOM, so elements within each row (views, hits, dl, peers) are all updated through JSON.

Its super lightweight and takes no work on reloading the entire website all over again, just takes that 1 ajax file. Its essentially 80-150kb of plain text and that makes for a good responsive experience.
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