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
[HACK] Similar Torrent [TTv3]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2021-11-27 13:51:05
It would be cool if it would use genre too, like maybe pull the genre from the imdb and use that, so action, comedy, etc
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-11-27 15:49:10
played with that you can try - using your code i linked

just noticed imdb doesnt have a table with data, ideally you would add a sql table and insert all data from here in torrent-details.php

        <b><?php echo T_("IMDB_LINK"); ?></b><br /> <a href="<?php echo $row['imdb']; ?>" target="_blank"><?php echo htmlspecialchars($row['imdb']); ?></a><br /><br />
       <b><?php echo T_("IMDB_RATED"); ?></b><br /> <?php echo $TTIMDB->getRated( $_data->Rated ); ?><br /><br />
       <b><?php echo T_("IMDB_ALIAS"); ?></b><br /> <?php echo $_data->Alias; ?><br /><br />
       <b><?php echo T_("IMDB_RELEASED"); ?></b><br /> <?php echo $TTIMDB->getReleased($_data->Released); ?><br /><br />
       <b><?php echo T_("IMDB_YEAR"); ?></b><br /> <?php echo $_data->Year; ?><br /><br />
       <b><?php echo T_("IMDB_RUNTIME"); ?></b><br /> <?php echo $_data->Runtime; ?><br /><br />
       <b><?php echo T_("IMDB_GENRE"); ?></b><br /> <?php echo $_data->Genre; ?><br /><br />
       <b><?php echo T_("IMDB_DIRECTOR"); ?></b><br /> <?php echo $_data->Director; ?><br /><br />
       <b><?php echo T_("IMDB_WRITER"); ?></b><br /> <?php echo $_data->Writer; ?><br /><br />
       <b><?php echo T_("IMDB_ACTORS"); ?></b><br /> <?php echo $_data->Actors; ?><br /><br />
       <b><?php echo T_("IMDB_PLOT"); ?></b><br /> <?php echo $_data->Plot; ?>


eg
SQL_Query_exec("INSERT INTO `imdb` (`genre`, `plot`,  `url`) VALUES ('$_data->Genre', '$_data->Plot', $row[imdb])");


because the torrent imdb table uses a url you need to pass $row[imdb] to insert into imdb table so we join by torrents/imdb & imdb/url

then the query would be pretty simple - var_dump() the fetch_assoc $var imdb sould show in results then we can fine tune
"SELECT torrents.id,  torrents.name,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image, torrents.imdb 
          FROM torrents
        LEFT JOIN categories ON torrents.category = categories.id
        LEFT JOIN imdb ON torrents.imdb = imdb.url
 WHERE (torrents.name
 LIKE {$query1})
 OR (torrents.category LIKE {$catid})
 OR (torrents.name LIKE {$query2})
 LIMIT 10"
2021-11-27 15:57:09
another quick option would be to add genre to torrents table
then insert just the $_data->Genre to the torrents table we can then search like torrents.genre
 $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));
$catid = str_replace(".", " ", sqlesc("%" . $row['category'] . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.id,  torrents.name,  torrents.genre,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.name
LIKE {$query1})
OR (torrents.category LIKE {$catid})
OR (torrents.name LIKE {$query2})
OR (torrents.gener LIKE {$genre})
LIMIT 10");


more work in first way but worth it, i did it with tmdb mod so in future from a table full of tmdb/imdb data i can search actor, genre, director

here is my tmdb table just needs renaming to match imdb data dont forget url should be included
CREATE TABLE `tmdbfilm` (
 `id` int(10) NOT NULL AUTO_INCREMENT,
 `id_tmdb` int(10) NOT NULL DEFAULT 0,
 `title` varchar(255) DEFAULT NULL,
 `duration` varchar(100) DEFAULT NULL,
 `producer` varchar(255) DEFAULT NULL,
 `genre` varchar(255) DEFAULT NULL,
 `plot` text DEFAULT NULL,
 `actor` longtext DEFAULT NULL,
 `trailer` varchar(100) DEFAULT NULL,
 `date` datetime DEFAULT NULL,
 `image` varchar(50) DEFAULT NULL,
 UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM;

Last edited by M-jay warn on 2021-11-27 15:59:29
2021-11-27 15:59:00
I was goofing around with this
// /////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"]='NULL'){
SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$_data->Genre). "' WHERE `id` = $id");
}
/////END genre

It puts the genre in the DB. I just made the column a varchar 255 null. Not sure what to do with the output or even where to use this lol
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-11-27 16:08:10
https://torrenttrader.uk/topic?topicid=9909&page=p#post67615

match and replace the query with this - you might need to manually insert a genre into some torrents imdb should be cached so wont insert any new ones straight away slimmed it down just for testing but should work

$query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.genre, torrents.id,  torrents.name,  torrents.genre,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.name
LIKE {$query1})
OR (torrents.genre LIKE {$genre})
LIMIT 10");
Last edited by M-jay warn on 2021-11-27 16:10:13
2021-11-27 16:24:20
the genre is going into the database like this picture shows. there are usually 3 words separated by a comma, like Action, Adventure, Sci-Fi. And it seems to just be using the same torrents over and over under similar, so I dont think its reading the row correctly, prolly because too many words and a comma or 2
Capture.PNG
File missing

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-11-27 16:28:03
2021-11-27 16:34:32
try replace
// /////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"]='NULL'){

SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$_data->Genre). "' WHERE `id` = $id");
}
/////END genre


with - we take just the first before ( , )    playing with this myself trying to add posters instead of using torrents.image1
// /////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"]='NULL'){
$str = strstr($_data->Genre, ',', true);
SQL_Query_exec("UPDATE `torrents` SET `genre` = '".mysqli_real_escape_string ($GLOBALS["DBconnector"],$str). "' WHERE `id` = $id");
}
/////END genre
2021-11-27 16:44:22
yea, I think we may be getting somewhere. Its only inserting the first genre keyword. gunna have to fiddle around
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-11-27 17:37:57
hmm, its still displaying the same similar torrents. I added code so I can see what genre is in the database. Any ideas? It has to be not correctly reading the DB, unless I created the table wrong. I used varchar 255 NULL https://ibb.co/Ydv7nxB
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-11-27 18:39:50
:unsure  if there is no errors it should work, we use LIMIT 10 on select so it would return the same 10 if name or genre match - this may include date in name ?

lets strip down another level lol
$query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$genre = str_replace(".", " ", sqlesc("%" . $row['genre'] . "%"));
$r = SQL_Query_exec("SELECT torrents.genre, torrents.id,  torrents.name,  torrents.genre,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON torrents.category = categories.id
WHERE (torrents.genre LIKE {$genre})
LIMIT 10");
2021-11-27 19:01:21
My opinion if it matters is that it is better to show you by name than by gender. For example, you have a movie in HD and the rest of the version of that movie should appear at similar torrents. This is simpler and fairer for users.
2021-11-27 19:06:06
imma beat my head on this desk lol. Here is my entire code. If a movie has a genre of ACTION, it is still showing torrents like HORROR, COMEDY, etc. I think I need to walk away for a few minutes, the word genre dont even look right anymore lol. I removed the str_replace since there is nothing to replace in the genre text that gets added. Oh, and you have torrents.genre twice in your query
////////////// Similar Torrents mod /////////////////////
begin_frame(T_("SIMILAR_TORRENTS"));
           $char1 = 50; //cut length
           $shortname = CutName(htmlspecialchars($a["name"]), $char1);
           $searchname = substr($row['name'], 0, 8);
           $query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
           $query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));
$genre = sqlesc("%" . $row['genre'] . "%");
// $r = SQL_Query_exec("SELECT torrents.id,  torrents.name, torrents.genre,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image FROM torrents LEFT JOIN categories ON (categories.id = torrents.category) WHERE (torrents.name LIKE {$query1} AND seeders > '0' AND torrents.id <> '$id') OR (torrents.name LIKE {$query2} AND seeders > '0' AND torrents.id <> '$id') OR (torrents.genre LIKE {$genre} AND seeders > '0' AND torrents.id <> '$id') ORDER BY seeders DESC LIMIT 10") or die(mysqli_error($GLOBALS["DBconnector"]));
$r = SQL_Query_exec("SELECT torrents.genre, torrents.id,  torrents.name,  torrents.size,  torrents.added,  torrents.seeders,  torrents.leechers,  torrents.category, categories.image
FROM torrents
LEFT JOIN categories ON (categories.id = torrents.category)
WHERE (torrents.genre LIKE {$genre} AND seeders > '0' AND torrents.id <> '$id')
LIMIT 10");

   if (mysqli_num_rows($r) > 0) {
           echo "<table width=100% class=main border=1 cellspacing=0 cellpadding=0 class=table_table>\n" . "
           <tr>
                   <td class='table_head' width='20'>Type</td>
                   <td class='table_head'>Name</td>
<td class='table_head'>Genre</td>
                   <td class='table_head' align='center'>Size</td>
                   <td class='table_head' align='center'>Added</td>
                   <td class='table_head' align='center'>S</td>
                   <td class='table_head' align='center'>L</td></tr>\n";
 
   while ($a = mysqli_fetch_assoc($r)) {
 //          $r2 = SQL_Query_exec("SELECT name, image FROM categories WHERE id=$a[category]");
 //          $a2 = mysqli_fetch_assoc($r2);
           $cat = "<img class=glossy src=\"images/categories/$a[image]\" alt=\"$a[name]\" title=\"$row[cat_parent] : $row[cat_name]\"\>";
           $name = $a["name"];
 
           echo"<tr><td class='table_col1' style='padding: 1px' align='center'>$cat</td>
                    <td class='table_col1'><a title=".$a["name"]." href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . CutName(htmlspecialchars($a["name"]), $char1) . "</b><br/></a></td>
<td class='table_col1' style='padding: 1px' align='center'>$a[genre]</td>
                    <td class='table_col1' style='padding: 1px' align='center'>" . mksize($a['size']) . "</td>
                    <td class='table_col1' style='padding: 1px' align='center'>$a[added]</td>
                    <td class='table_col1' style='padding: 1px' align='center'><span style='color:Chartreuse'>$a[seeders]</span></td>
                    <td class='table_col1' style='padding: 1px' align=center><span style='color:red'>$a[leechers]</span></td></tr>\n";
   }
     
   echo "</table>";
     
   }
               else {
                   print(T_("NO_SIMILAR_TORRENT_FOUND"));
               }
end_frame();
////////////// End Similar Torrents mod /////////////////////

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-11-27 19:10:28
2023-02-07 23:50:39
Just wanted to post my code for "similar genre" of torrent. It is something different, and feel free to use it if you want to. This requires the IMDB mod https://torrenttrader.uk/post?id=12&page=1 . and you would also have to create a new table in the database for "genre".
SQL for genre
ALTER TABLE `torrents` ADD `genre` varchar(10) DEFAULT NULL; 

Add this to torrents-details.php somewhere
////ADD genre pulled from the IMDB and put it in the stupid database as genre
if ($row["genre"] === NULL) {
$genre = explode(',', $_data->Genre)[0];
$escapedGenre = mysqli_real_escape_string($GLOBALS["DBconnector"], $genre);
SQL_Query_exec("UPDATE `torrents` SET `genre` = '$escapedGenre' WHERE `id` = $id");
 }
 $TTCache->Set("imdb/$id", $_data, 900);
}


and then the mod
////////////// Similar Torrents mod /////////////////////
begin_frame(sprintf(T_("SIMILAR_GENRE_HEADER"), " $genre "));
$char1 = 50;
$name = htmlspecialchars($a["name"]);
$genre = htmlspecialchars($a["genre"]);
$shortname = CutName($name, $char1);
$shortgenre = CutName($genre, $char1);
$searchname = substr($name, 0, 9);
$searchgenre = substr($genre, 0, 9);
$queryname1 = str_replace(" ", ".", sqlesc("%$searchname%"));
$queryname2 = str_replace(".", " ", sqlesc("%$searchname%"));
$querygenre1 = sqlesc("$searchgenre");


$r = SQL_Query_exec("SELECT id, name, genre, size, added, seeders, leechers, category, image1
                    FROM torrents
                    WHERE (genre LIKE {$querygenre1} OR name LIKE {$queryname1} OR name LIKE {$queryname2})
                    AND (genre = (SELECT genre FROM torrents WHERE id = '$id') OR name = (SELECT name FROM torrents WHERE id = '$id'))
                    AND seeders > '0' AND id <> '$id'
                    ORDER BY RAND() DESC
                    LIMIT 5");


   if (mysqli_num_rows($r) > 0) {
           echo "<table width=100% class=main border=1 cellspacing=0 cellpadding=0 class=table_table>\n" . "
           <tr>
                   <td class='table_head' width='20'>Type</td>
                   <td class='table_head'>Name</td>
<td class='table_head' align='center'>Genre</td>
                   <td class='table_head' align='center'>Size</td>
                   <td class='table_head' align='center'>Added</td>
                   <td class='table_head' align='center'>S</td>
                   <td class='table_head' align='center'>L</td></tr>\n";
 
   while ($a = mysqli_fetch_assoc($r)) {
         $r2 = SQL_Query_exec("SELECT name, image FROM categories WHERE id=$a[category]");
         $a2 = mysqli_fetch_assoc($r2);
           $cat = "<img class=glossy src=\"images/categories/$a2[image]\" alt=\"$a2[name]\" title=\"$row[cat_parent] : $row[cat_name]\"\>";
           $name = $a["name"];
 
           echo"<tr><td class='table_col1' style='padding: 1px' align='center'>$cat</td>
                    <td class='table_col1'><a title=".$a["name"]." href=torrents-details.php?id=" . $a["id"] . "&hit=1><b>" . CutName(htmlspecialchars($a["name"]), $char1) . "</b><br/></a></td>
<td class='table_col1' style='padding: 1px' align='center'>$a[genre]</td>
                    <td class='table_col1' style='padding: 1px' align='center'>" . mksize($a['size']) . "</td>
                    <td class='table_col1' style='padding: 1px' align='center'>$a[added]</td>
                    <td class='table_col1' style='padding: 1px' align='center'><span style='color:Chartreuse'>$a[seeders]</span></td>
                    <td class='table_col1' style='padding: 1px' align=center><span style='color:red'>$a[leechers]</span></td></tr>\n";
   }
     
   echo "</table>";
     
   }
               else {
                   print(T_("NO_SIMILAR_TORRENT_FOUND"));
               }
end_frame();
////////////// End Similar Torrents mod /////////////////////

language file
$LANG["SIMILAR_GENRE_HEADER"] = "Similar torrents in the %s category";

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2023-02-08 00:09:17
Thanks MM
Or maybe something like that:
//===| Start Similar Torrents |===//
begin_frame(T_("SIMILAR_TORRENTS"));

$searchname = substr($row['name'], 0, 10);
$query1 = str_replace(" ", ".", sqlesc("%" . $searchname . "%"));
$query2 = str_replace(".", " ", sqlesc("%" . $searchname . "%"));

$rc = SQL_Query_exec("SELECT id FROM torrents WHERE name LIKE {$query1} AND seeders > '0' AND id <> '$id' OR name LIKE {$query2} AND seeders > '0' AND id <> '$id'");
$count = mysqli_num_rows($rc);
$perpages = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpages, $count, "torrents-details.php?id=$id&");

$r = SQL_Query_exec("SELECT
id,
name,
size,
added,
imdb,
genre,
rosub,
ensub,
roeng,
seeders,
leechers,
category,
external,
filename,
freeleech
FROM torrents
WHERE name LIKE {$query1} AND seeders > '0' AND id <> '$id'
OR name LIKE {$query2} AND seeders > '0' AND id <> '$id'
ORDER BY id DESC $limit");
   
if (mysqli_num_rows($r) > 0) {
if ($count > $perpages) { echo $pagertop; }
echo "<table width=100% class=table_table border=0 cellspacing=0 cellpadding=4>\n" . "
<tr>
<td class='table_head' width='1%' align='center'><b>".T_("TYPE")."</b></td>
<td class='table_head'><b>".T_("TORRENT_NAME")."</b></td>
<td class='ttable_head' align='center'><img src='images/down.png' border='0' title='".T_("T_DOWNLOAD")."'></td>
<td class='table_head' align='center'><img src='images/t-size.png' border='0' title='".T_("SIZE")."'></td>
<td class='table_head' align='center'><img src='images/t-date.png' border='0' title='".T_("ADDED")."'></td>
<td class='table_head' align='center'><img src='images/arrow_up.png' border='0' title='".T_("SEEDERS")."'></td>
<td class='table_head' align='center'><img src='images/arrow_down.png' border='0' title='".T_("LEECHERS")."'></td>";
if ($site_config["ALLOWEXTERNAL"]) {
echo "<td class='table_head' align='center'><img src='images/t_le.png' border='0' title='".T_("T_L_OR_E")."'></td>";
}
echo "</tr>\n";
   
while ($a = mysqli_fetch_assoc($r))
{
//==| Category
           $r2 = SQL_Query_exec("SELECT name, image, parent_cat FROM categories WHERE id=$a[category]");
           $a2 = mysqli_fetch_assoc($r2);
           $cat = "<img src='images/categories/".$a2['image']."' alt='".$a2['name']."' title='".$a2['parent_cat']." - ".$a2['name']."'>";

//==| Bookmark Torrents
$bookt = SQL_Query_exec("SELECT torrentid FROM bookmarks WHERE torrentid = $id AND userid = $CURUSER[id]");
if (mysqli_num_rows($bookt) > 0) { $bookmark = "<a href='takedelbookmark.php?bookmarkid=".$row[id]."'><img src='images/bookmark_delete.png' border='0' title='".T_("T_DELETE_BOOKMARK")."'></a>"; }
else { $bookmark = "<a href='bookmarks.php?torrent=$id'><img src='images/bookmark.png' border='0' title='".T_("T_ADD_BOOKMARK")."'></a>"; }

//==| Free Leech Torrents
if ($a["freeleech"] == 1 && $a["external"] != "yes") { $freeleech = "<img src='images/free.png' border='0' title='".T_("T_FREE_LEECH")."'>"; } else { $freeleech = ""; }

//==| Subtitles
if ($a["rosub"] == "yes") { $rosub = "<img src='images/rosub.png' border='0' title='".T_("ROSUBBED")."'>"; } else { $rosub = ""; }
if ($a["ensub"] == "yes") { $ensub = "<img src='images/flag.eng.gif' border='0' title='".T_("ENSUBBED")."'>"; } else { $ensub = ""; }
if ($a["roeng"] == "yes") { $roeng = "<img src='images/ro-eng-flag.png' border='0' title='".T_("ROENGSUBBED")."'>"; } else { $roeng = ""; }

//==| IMDB Link
if (!empty($a["imdb"])) { $imdb = "<a href=".$a["imdb"]." target='blank'><img src='images/imdb.png' border='0' title='".T_("T_IMDB")."'></a>"; } else { $imdb = ""; }

//==| Torrents Genre
if (!empty($a["genre"])) { $genre = "&nbsp;".T_("GENRE").": ".$a["genre"].""; } else { $genre = ""; }

//==| Local/External Torrent
if ($site_config["ALLOWEXTERNAL"]) {
if ($a["external"]=='yes') { $external = "<img src='images/t_extern.png' border='0' title='".T_("T_EXTERNAL_TORRENT")."'>"; }
else { $external = "<img src='images/t_local.png' border='0' title='".T_("T_LOCAL_TORRENT")."'>"; }
}

$char1 = 50; // cut name length
$smallname = htmlspecialchars(CutName($a["name"], $char1));
$dispname = "<b>".$smallname."</b>";

echo"<tr>";
echo"<td class='table_col2' align='center'>$cat</td>";
echo"<td class='table_col2'>$bookmark <a href=\"javascript: klappe_torrent('t".$a['id']."')\"></a><a title=\"".$a["name"]."\" href=\"torrents-details.php?id=$a[id]&hit=1\">$dispname</a> $freeleech $rosub $ensub $roeng<div style=margin-top:3px>$imdb $genre</div></td>";
echo"<td class='ttable_col2' align='center'><a href=\"download.php?id=".$a['id']."&name=".rawurlencode($a["filename"])."\"><img src='images/icon_down.png' border='0' title=\"".T_("T_DOWNLOAD_TORRENT")."\" /></a></td>";
echo"<td class='table_col1' align='center'>".mksize($a[size])."</td>";
echo"<td class='table_col2' align='center'>".date("<\\b>d.M.Y<\\/\\b><\\b\\r>H:i", utc_to_tz_time($a[added]))."</td>";
echo"<td class='table_col1' align='center'><font color='#00BA00'><b>".$a['seeders']."</b></font></td>";
echo"<td class='table_col2' align=center><font color='#FF0000'><b>".$a['leechers']."</b></font></td>";
if ($site_config["ALLOWEXTERNAL"]) {
echo "<td class='table_col1' align='center'>".$external."</td>";
}
echo"</tr>\n";
}
echo "</table>";
     
   }
else {
print(T_("NOTHING_FOUND"));
}
end_frame();
//===| End Similar Torrents |===//

2023-02-11 19:06:13
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.
Last edited by STorrents2020 on 2023-02-11 19:13:50
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