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

Does this mean anything? — 2020-04-01 01:35:39 in v3 Support
Normal behavior (depends on how you setup firewall rules)
This does exactly the same as cloudflare does in hiding emails from bots and those who has javascript disabled, except cloudflare has a better handling and more options

As  you can read here -> https://support.cloudflare.com/hc/en-us/articles/200170016-What-is-Email-Address-Obfuscation-
Easier way to use pseudo-cryptographically secure key

1. Create new column (varchar 255) in torrents table named for example 'cryptographical_key'
2. Update torrents-upload.php with insert value add the last value to be ".bin2hex(random_bytes(10))."
3. Update download.php -  '$res = SQL_Query_exec("SELECT filename, banned, external, announce FROM torrents WHERE id =".intval($id)); '
to $res = SQL_Query_exec("SELECT filename, banned, external, announce FROM torrents WHERE cryptographical_key = $key
4. Update torrents-details.php - add into SELECT 'cryptographical_key', then for download instead of 'download.php?id=$id'
add download.php?id=".$row['cryptographical_key']."

The final result will be something like domain.com/download.php?id=af6d1ddfdd95a91f985a
You have this option defaulted if you use cloudflare.

Also you can use <!--sse-->  Bad visitors won't see text / html which i write here <!--/sse-->
— 2020-03-25 16:48:58 in
You should create regular expressions for smilies or I will do it when I get again free time.

in find = [] '~\:\)~s' will match :)

so in replace  =[] just put '<img src="/image/to/smilie">'

And format comment should be ditched all together, very bad structure, and too much querying all regex even if only 1 is used.
— 2020-03-24 23:09:47 in
Creating a new bbcode:

Explained:
@var string = 'b' = The bbcode you want to use; example just write 'b'
@var array = [] = special options you want to set as parameters (optional)
@var bool (true | false) = if you want to include content which user write (true); if you want custom message (false)
@var $special = elements for array
@var $content = the content which will user write between tags


$bb->register('b', [], true, function($special, $content)
{    
   return '<b>'.$content.'</b>';
});


This will return: text


$bb->register('staff', ['color'=>'red', 'font'=>'bold'], true, function($special, $content)
{    
   return '<span style="color:'.$special['color'].';font-weight: '.$special['font'].'">'. $content .'</span>';
});


This will return [staff]text[/staff]
// red color, bold text
— 2020-03-24 22:43:05 in
here's one gift for your PDO project. This is a way more advanced parsing system from the one used in format_comment();
I've used some base of wordpress and made it fully dynamical, where user can set it's own bbcodes with 1 line of code.

PS: Also viable option is to ditch completely bbcodes and use the markdown parser like github, reddit, laravel, etc.
[URL unfurl="true"]https://parsedown.org/[/url]

This is by far the most cross scripting, future rich parser for PHP.

Anyway, back to the bbcode parser:

Installation:
Shortcode.php class
Shortcode.php class
[code]
[USER=20288]@m-jay[/USER], warning are shown because of undefined stuff.

You can't go like this for example because it will throw an warning and we should NOT supress warnings.

foreach ($stmt as $row)
{
  $random = $row['username'];
}

Should be:

$random = '';
foreach ($stmt as $row)
{
  $random = $row['username'];
}


You must either check in every file if curuser is set

if (isset($CURUSER) && $CURUSER['class'] === 1)

or

$GLOBALS['CURUSER'] = (isset($CURUSER) ? $CURUSER : null);
torrents-details.php — 2020-03-23 09:44:35 in v2.08 Support
"STorrents2020, post: 68218, member: 20382":

This actually simply secures download links to to SHA1 hash I believe, this was only to obfuscate download URLs with no other intention. What you want to do is start working with $_GET and register torrent.name into the variable and call it manually to test working, but you must updated a LOT of internal references to the script/ID or you will have dead links everywhere.

ID and Name can both be used. Name is good for SEO, ID is a little dated, but hook-efficient (you can call it throughout the script without much effort).

I'll be working on this one tomorrow as I do care about SEO and that will bring some changes to the rewrite rules too.

You don't really want a good seo with describing links on search engine...

You will get hit so hard by dmca bots.

But in fact this is rather easy and you just have to change links into torrenttable and thats it, append name without forcing it is the best.
torrents-details.php — 2020-03-23 01:18:37 in v2.08 Support
"MicroMonkey, post: 68209, member: 311":

Im just confused as to why this matters? I think someone asked about this very thing a few years ago. Not sure if anyone addressed it or not.

You have 5 boxes with same shape and same color which are filled with different items inside. How can I know which items are inside if I can't peek?
You have to set some unique marker on them so I can pick the item I want from the box.
torrents-details.php — 2020-03-22 22:53:07 in v2.08 Support
What if 2 torrents share exactly same name?
This whole mod is TERRIBLE.

1. You CAN NOT use <a href="link" method="POST">
2. You CAN NOT use for loop with fetch inside.
3. This mod will NOT WORK on PHP 7+

Here is a simple rewrite from me: (Still, you shouldn't use this old torrent trader)

<?php
if (isset($_COOKIE['uid']) && isset($_COOKIE['pass']))
{

   /* @var $_COOKIE ['uid'] = $userid;
    * Change language for a currently logged user.
    * basic mod by shadows @ torrenttrader.xyz
    */

   begin_frame("Select your language");
   $stmt = mysql_query("SELECT *, COUNT (id) as 'found_languages' FROM languages");
   $row = mysql_fetch_assoc($stmt);

   if ($row && $row['found_languages'] > 0)
   {
       echo '<form method="post">';
       foreach ($row as $item)
       {
           echo '<input type="radio" name="language" value="' . $item['id'] . '">' . $item['name'] .'<br>';
       }
       echo '<input type="hidden" name="change_language" value="1">';
       echo '</form>';
   }

   if ($_SERVER['REQUEST_METHOD'] === 'POST')
   {
       if ($_POST['change_language'] == 1)
       {
           mysql_query("UPDATE users SET language = ".$_POST['language']." WHERE id = ".$_COOKIE["uid"]."");
           begin_frame("Language changed");
           echo 'Language changed';
       }
   }
}
@mysql_query is the reason why it's not working.
[USER=20288]@m-jay[/USER] there are several flaws with your isValidCookie

1. This has a flawed logic, strlen($_COOKIE['pass'] ?? '') != 60 will never work, because you can't expect cookie to be always 60 characters, it will pass that number often or be lower.
2. !is_numeric($_COOKIE['uid'] ?? 0)) will never work the way you want ( ?? return only 1 / 0) so anyone setting cookie as 0, your if statement will read it as 1 and that is security flaw :D

$p = '21';
$a = 21;
$k = '0';
$t = 're';

echo is_numeric($p ?? 0) . "\n";
echo is_numeric($a ?? 0) . "\n";
echo is_numeric($k ?? 0) . "\n";
echo is_numeric($t ?? 0) . "\n";

// output
1
1
1



3. You should just check if it's integer and bigger than zero.
4. No need to use return in new row.

Here's the optimal return
    public function isvalidcookie() {
   if (!is_numeric($_COOKIE['uid']) || (int) $_COOKIE['uid'] < 1 || !isset($_COOKIE['pass']) ) {
       return (new Cookie)->logoutcookie();
   }
   }
Peer User ID - Bug — 2020-03-19 01:47:18 in v3 Support
Then the problem is not SQL, the problem comes from somewhere else.
I'll be deleting all of his spam posts as they serve no purpose at all.
That's not safe, anyone can make random cookie with uid = 1 and get access. You must password_verify it
Peer User ID - Bug — 2020-03-18 13:19:27 in v3 Support
Can you query the sql i wrote into cli or phpmyadmin so i can see thw output, then paste it here

It works excellent in my example: (3 users, all of them have 3 different avatars and 3 different names)
[URL unfurl="true"]http://sqlfiddle.com/#!9/0247fa/5[/url]
Try something like this:

Class:
public function curuser()
{
   $stmt = $this->db->run("SELECT * FROM users WHERE id = 1");

   if ($stmt && password_verify(/** */))
   {
       foreach ($stmt as $item => $value)
       {
           return $data[$item] = $value;
       }
   }

   /*
    * If not current user / return false
    */
   return false;
}


Inside app

$user = new User();
echo $user->curuser()['username'];

// Strict check
if ($user->curuser() === false)
{
   echo 'Not logged in';
}
// Less strict check
if (!$user->curuser())
{
   echo 'Not logged in';
}


Or you can create a check for if logged in

Class:
public function loggedIn()
{
   if ($this->curuser() === false)
   {
       return false;
   }

   return true;
}


And in app

if ($user->loggedIn())
{
   echo $user->curuser()['username'];
}


---------

Edit:
You can also use GLOBALS like this:
Class:

public function curuser()
{
   $stmt = $this->db->query("SELECT * FROM users WHERE id = 2");

   if ($stmt && password_verify(/** */))
   {
       foreach ($stmt as $item => $value)
       {
           return $data[$item] = $GLOBALS['CURUSER'] = $value;

       }
   }

   /*
    * If not current user / return false
    */
   return false;
}

App:

/*
* User class included
*/
global $CURUSER;
$user = new User($db_handler);
$user->curuser();

echo $CURUSER['username'];
Peer User ID - Bug — 2020-03-17 12:49:46 in v3 Support
"STorrents2020, post: 68165, member: 20382":

Your query (corrected above) is working like a charm, I commented vars in the loop and directed the rest to $query outside the loop, nice! thnx - this is a optimization though no?

For readability you should always practice writing it like i did in a new row, thats what you must do anyway if you ever work as web developer, never in single line.

You still  have several hiccups which are bad in this, will fix when I get home

Edit: never user mysqli_num_rows and pdo->rowCount in your code, the way it works it allocates additional memory, loops through whole table, fetches data and locks table.

Always use SELECT COUNT() because with correct index structure it will speed up process for more than 200%

Of course, weight structure of index tables into SQL are wrong, whoever made them, had little to no knowledge of indexes.

1st way:
This requires LEFT JOIN to always return results in order to count data.
$query  = SQL_Query_exec("
SELECT peers.*, users.*, COUNT(peers.id) as 'found_num'
FROM peers
LEFT JOIN users
ON (peers.userid = users.id)
WHERE peers.torrent = $id
ORDER BY peers.seeder DESC
");


2nd way:
This has a better structure and can be customized for your needs when counting
$query  = SQL_Query_exec("
SELECT peers.*, users.*,
(
   SELECT COUNT(peers.id)
   FROM peers
   WHERE peers.torrent = $id
) as 'found_num'
FROM peers
LEFT JOIN users
ON (peers.userid = users.id)
WHERE peers.torrent = $id
ORDER BY peers.seeder DESC
");
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