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
Site torrent catalog
Controls ·  Search New posts · Mark unread

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

2022-12-29 21:16:02
@M-Jay - Interesting about the search bit, I am about to get into my search too and implement search operators (like Github, Craigslist, StackOverflow, etc).

Specific keywords that act as safe query conditions. This may apply useful for the movie stuff.

For example, Google has 42 advanced search operators! You can imagine the power of what that provides when filtering out results under specific criteria. I plan to do this.
2023-04-29 18:05:05
Hi gang !


Merci pour ce partage, mais il y a une personne qui la compléter pour la description TMDB  ou ALLOCINE qui pourrais le partagé la modification s'il vous plais.
---------------------------
Thank you for this sharing, but there is a person who completes it for the TMDB or ALLOCINE description who could share the modification please.
Last edited by spiritblue on 2023-04-29 18:05:59
2023-04-30 11:51:11
@spiritblue

Hi mate, I don't use TMDB or ALLOCINE but if you need some fix on it I send you PM


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-04-30 17:30:30
Thank you very much for your help, I will test this and get back to you with the rest if necessary, thank you Botanicar
2026-02-01 15:06:22
updated. Here ya go.
<?php
require_once("backend/functions.php");

dbconn();
loggedinonly();

$db = $GLOBALS["DBconnector"];

function catalog_h($v)
{
   return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8');
}

function catalog_bind_stmt($stmt, $types, &$params)
{
   if (!$types || !$params) {
       return;
   }

   $bind = [];
   $bind[] = $types;

   foreach ($params as $k => $v) {
       $bind[] = &$params[$k];
   }

   call_user_func_array([$stmt, 'bind_param'], $bind);
}

function catalog_build_filter($search, $letter)
{
   $search = trim((string)$search);
   $letter = strtolower(trim((string)$letter));

   $where = "t.visible != 'no'";
   $params = [];
   $types = '';
   $q = '';

   if ($search !== '') {
       $where .= " AND t.name LIKE ?";
       $params[] = $search . '%';
       $types .= 's';
       $q = "search=" . urlencode($search);
   } else {
       if (strlen($letter) !== 1 || strpos("0123456789abcdefghijklmnopqrstuvwxyz", $letter) === false) {
           $letter = 'a';
       }

       $where .= " AND t.name LIKE ?";
       $params[] = $letter . '%';
       $types .= 's';
       $q = "letter=" . urlencode($letter);
   }

   return [$where, $params, $types, $q, $letter, $search];
}

function catalog_render_filters($active)
{
   echo "<div class='catalog-filter-groups'>";

   echo "<div class='catalog-filter-row catalog-filter-row-letters'>";
   foreach (range('a', 'z') as $c) {
       $u = strtoupper($c);

       if ($c === $active) {
           echo "<span class='catalog-filter-item active'>{$u}</span>";
       } else {
           echo "<a class='catalog-filter-item' href='?letter=" . catalog_h($c) . "'>{$u}</a>";
       }
   }
   echo "</div>";

   echo "<div class='catalog-filter-row catalog-filter-row-numbers'>";
   foreach (range(0, 9) as $n) {
       $n = (string)$n;

       if ($n === $active) {
           echo "<span class='catalog-filter-item active'>{$n}</span>";
       } else {
           echo "<a class='catalog-filter-item' href='?letter=" . catalog_h($n) . "'>{$n}</a>";
       }
   }
   echo "</div>";

   echo "</div>";
}

function catalog_pager($page, $pages, $q)
{
   if ($pages <= 1) {
       return;
   }

   echo "<div class='catalog-pager'>";

   if ($page > 1) {
       echo "<a class='catalog-page-link' href='?" . catalog_h($q) . "&page=" . ($page - 1) . "'><<</a>";
   }

   for ($i = max(1, $page - 3); $i <= min($pages, $page + 3); $i++) {
       if ($i == $page) {
           echo "<span class='catalog-page-link active'>{$i}</span>";
       } else {
           echo "<a class='catalog-page-link' href='?" . catalog_h($q) . "&page={$i}'>{$i}</a>";
       }
   }

   if ($page < $pages) {
       echo "<a class='catalog-page-link' href='?" . catalog_h($q) . "&page=" . ($page + 1) . "'>>></a>";
   }

   echo "</div>";
}

function catalog_img_html($row, $cfg)
{
   if (empty($row['image1'])) {
       return "<img src='images/no_poster.png' width='150' height='220' alt='No image'>";
   }

   $u = $cfg['SITEURL'] . "/uploads/images/" . rawurlencode($row['image1']);

   return "<img src='" . catalog_h($u) . "' width='150' height='220' alt='" . catalog_h($row['name']) . "'>";
}

$search = $_GET['search'] ?? '';
$letter = $_GET['letter'] ?? '';
$page = max(1, (int)($_GET['page'] ?? 1));
$perpage = 4;

list($where, $params, $types, $q, $active, $search) = catalog_build_filter($search, $letter);

if ($CURUSER['view_xxx'] != 'yes') {
   $where .= " AND t.category NOT IN (40,7)";
}

stdhead("Catalog");
begin_frame("Catalog");

echo '<style>
.catalog-filter-groups{margin:10px 0 16px 0}
.catalog-filter-row{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}
.catalog-filter-row-letters{margin-bottom:8px}
.catalog-filter-row-numbers{margin-top:2px}
.catalog-filter-item{padding:6px 10px;border:1px solid #444;background:#1f1f1f;color:#ccc;border-radius:6px;text-decoration:none;font-weight:bold}
.catalog-filter-item.active{background:#1fa34a;color:#fff;box-shadow:0 0 6px rgba(0,255,120,.5)}
.catalog-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px;margin:15px}
.catalog-card{background:#1b1b1b;border:1px solid #333;border-radius:10px;overflow:hidden}
.catalog-card-header{padding:10px;background:#222;font-weight:bold}
.catalog-card-body{display:flex;gap:12px;padding:12px}
.catalog-desc{max-height:150px;overflow:auto;background:#111;padding:8px;border:1px solid #333;border-radius:6px;margin-top:8px}
.catalog-stat{padding:6px 10px;background:#111;border-radius:5px;border:1px solid #333;font-weight:bold}
.catalog-actions{margin-top:10px;display:flex;gap:8px;flex-wrap:wrap}
.catalog-btn{padding:6px 10px;background:#333;border-radius:6px;text-decoration:none;color:#fff;display:inline-block}
.catalog-btn.primary{background:#1e6bd6}
.catalog-pager{display:flex;justify-content:center;gap:6px;margin:10px;flex-wrap:wrap}
.catalog-page-link{padding:6px 10px;background:#1f1f1f;border-radius:6px;text-decoration:none;color:#ccc}
.catalog-page-link.active{background:#1e6bd6;color:#fff}
@media (max-width:700px){
.catalog-card-body{flex-direction:column}
}
</style>';

echo "<center>
<form method='get'>
<input type='text' name='search' value='" . catalog_h($search) . "' placeholder='Search'>
<input type='submit' value='Search'>
</form>
</center>";

catalog_render_filters($active);

$stmt = $db->prepare("SELECT COUNT(*) FROM torrents t WHERE $where");
if (!$stmt) {
   die("Prepare failed: " . catalog_h($db->error));
}

$countParams = $params;
catalog_bind_stmt($stmt, $types, $countParams);
$stmt->execute();
$stmt->bind_result($total);
$stmt->fetch();
$stmt->close();

$total = (int)$total;
$pages = max(1, (int)ceil($total / $perpage));
$page = min($page, $pages);
$offset = ($page - 1) * $perpage;

catalog_pager($page, $pages, $q);

$sql = "SELECT
t.id,
t.name,
t.size,
t.image1,
t.descr,
t.filename,
t.seeders,
t.leechers,
t.times_completed,
c.name AS cat_name,
c.parent_cat
FROM torrents t
LEFT JOIN categories c ON t.category = c.id
WHERE $where
ORDER BY t.name ASC
LIMIT ?, ?";

$mainParams = $params;
$mainParams[] = $offset;
$mainParams[] = $perpage;
$mainTypes = $types . "ii";

$stmt = $db->prepare($sql);
if (!$stmt) {
   die("Prepare failed: " . catalog_h($db->error));
}

catalog_bind_stmt($stmt, $mainTypes, $mainParams);
$stmt->execute();
$res = $stmt->get_result();

echo "<div class='catalog-grid'>";

while ($row = $res->fetch_assoc()) {
   $id = (int)$row['id'];
   $name = catalog_h($row['name']);
   $size = mksize((int)$row['size']);
   $downloads = (int)$row['times_completed'];
   $seeders = (int)$row['seeders'];
   $leechers = (int)$row['leechers'];

   echo "<div class='catalog-card'>";
   echo "<div class='catalog-card-header'>{$name}</div>";

   echo "<div class='catalog-card-body'>";
   echo "<div>" . catalog_img_html($row, $site_config) . "</div>";
   echo "<div style='flex:1'>";

   echo "<div><b>Category:</b> " . catalog_h($row['parent_cat']) . " > " . catalog_h($row['cat_name']) . "</div>";
   echo "<div><b>Size:</b> {$size}</div>";
   echo "<div><b>Downloads:</b> {$downloads}</div>";

   echo "<div class='catalog-desc'>" . format_comment($row['descr']) . "</div>";

   echo "<div style='display:flex;gap:8px;margin-top:8px;flex-wrap:wrap'>";
   echo "<div class='catalog-stat' style='color:#4cff88'>▲ {$seeders}</div>";
   echo "<div class='catalog-stat' style='color:#ff5c5c'>▼ {$leechers}</div>";
   echo "</div>";

   echo "<div class='catalog-actions'>";
   echo "<a class='catalog-btn primary' href='download.php?id={$id}&name=" . rawurlencode($row['filename']) . "'>Download</a>";
   echo "<a class='catalog-btn' href='torrents-details.php?id={$id}'>Details</a>";
   echo "</div>";

   echo "</div>";
   echo "</div>";
   echo "</div>";
}

echo "</div>";

$stmt->close();

catalog_pager($page, $pages, $q);

end_frame();
stdfoot();
?>

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 2026-03-29 09:16:35
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