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

Ratio freezes at 0 — 2023-03-15 17:03:26 in v3 Support
This controls the upload bytes have you made any edits around here in announce
https://github.com/MicrosoulV3/TorrentTrader-v3/blob/5938d40c417b56dd59c4d03c974c8ee9438c840e/TorrentTrader%203.0/upload/announce.php#L284
Also they is a 10 minute delay, if longer then 10 minutes check peers on torrents details is anything updated there
just catching up on post and this and the cache class look interesting mate, nice work ill test this this week

go to sql admin - try add default value 1 to season
I think it would be css to make it always show
Maybe shoutbox_body & shoutbox_container
Best way to do this is right click on browser, inspect page and play with height
You can make make browser smaller as well to check mobile view
thanks for example  👍
Example of a ajax get call.
Retrieve data and show on another page. We use $_GET  to identify a id

replace anything underneath this line to modify for your own needs
// count & update stats (internal only should be wrapped)

if any only can improve this simple example like how to pass the id better please post.

visit yourdomain/test.php?id=(ADD NUMBER HERE)

create test.php
<?php
// get id from url
$id = (int) $_GET['id'] ?? 0;
?>
<p id="load_torrent_stats"></p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
   function torrent_stats(){
       // load stats from page with id from url
       $('#load_torrent_stats').load('stat.php?id=<?= $id ?>');
   }
   setInterval( "torrent_stats()", 150000 );
torrent_stats();
</script>

create stat.php - enter db details at top
<?php
// db stuff
$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();
}

// get id from url
$id = (int) $_GET['id'];

// what we want in array
$stats = [
   'seeders' => 0,
   'leechers' => 0
];

// count & update stats (internal only should be wrapped)
$sth = $conn->prepare("SELECT seeder FROM peers  WHERE torrent = $id");
$sth->execute();
$result = $sth->fetchAll();
foreach ($result as $row) {
   if ($row['seeder'] == 'no') {
       $stats['leechers']++;
   } else {
       $stats['seeders']++;
   }
}

var_dump($stats);
New_Theme — 2023-01-15 05:46:22 in v3 Themes
Thank you
editing torrents — 2023-01-12 06:23:51 in v2.08 Support
I use this for upload file errors
https://torrenttrader.uk/post?id=9794

For upload database errors you could allow members to delete for 1

Welcome to the site, we have a very friendly community here.
Format Comment — 2023-01-03 07:35:03 in v3 Support
Nice function mate big improvement will test this out
More modern and replaces the slow preg
TT installer — 2022-12-27 20:21:30 in M-BiTsy Support
Ended up having to split the dB insert and the dB check so ended up with 6 steps, although I should put insert user data and create first user
Thinking of similar approach to update, just a update file which checks version, any dB changes and checks dir files last modified to check files have been added
Thanks I'll try them, going to move a lot a css inline on the templates so to customise the upload page you just edit the upload template
I came close to removing bootstrap but I think I have a good balance now where its a bootstrap frame with them benefits but it's mainly css
I'm going to move to less or sass for css processor

To edit a theme you just need to change 5 colours in css primary, secondary, third etc then we use eg background-color:var(primary)

TT installer — 2022-12-19 10:51:48 in M-BiTsy Support
Backup db first demo only
Decided to remove check.php and ended up replacing it with a install.

This to help users install so don't think there's much need but thought id post idea while its still basic. will work on v3 for demo but v3 files are a little different it wont over write anything - just a demo config file will be placed in backend

just add this at top of index.php below <?php
if (file_exists("install.php")) {
   include 'install.php';
   die();
}


then create file install.php and place in root
<?php

// Template Data Array
$data = array();

// Check Url Correct
function check_url() {
   $data['url'] = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
   $check = substr($data['url'], -1);
   if ($check == '/') {
       $data['url'] = substr($data['url'], 0, -1);
   }
   $data['full_url'] = $data['url'].'/index.php';
   setcookie("url", $data['full_url'], time() + (86400 * 30), "/");
   return $data;
}

// Check php ini Settings
function get_php_setting($val)
{
   $r = (ini_get($val) == '1' ? 1 : 0);
   return $r ? 'ON' : 'OFF';
}

// Check Server Settings
function check_enviroment() {
$php_recommended_settings = array(
   array('Safe Mode', 'safe_mode', 'OFF'),
   array('Display Errors (Can be off, but does make debugging difficult.)', 'display_errors', 'ON'),
   array('File Uploads', 'file_uploads', 'ON'),
   array('Register Globals', 'register_globals', 'OFF'),
   array('Output Buffering', 'output_buffering', 'OFF'),
   array('Session auto start', 'session.auto_start', 'OFF'),
   array('allow_url_fopen (Required for external torrents)', 'allow_url_fopen', 'ON'),
);

$version = phpversion() < '8' ? '<b><font color="red">No</font> 8 or above required</b>' : '<b><font color="green">Yes</font></b>';
$pdoext = extension_loaded('PDO') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$sockets = extension_loaded('sockets') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$mb = extension_loaded('mbstring') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$gd = extension_loaded('gd') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$zlib = extension_loaded('zlib') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$xml = extension_loaded('xml') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$curl = function_exists('curl_init') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$openssl = extension_loaded('openssl') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';
$bcmath = extension_loaded('bcmath') ? '<b><font color="green">Available</font></b>' : '<b><font color="red">Unavailable</font></b>';

$html = "<div class='row p-3'>";
$html .= "<div class='col-7'>PHP version >= 8</div>";
$html .= "<div class='col-5'>$version - Your PHP version is " . phpversion() . "</div>";
$html .= "<div class='col-7'>PDO Ext</div>";
$html .= "<div class='col-5'>$pdoext</div>";
$html .= "<div class='col-7'>sockets support</div>";
$html .= "<div class='col-5'>$sockets</div>";
$html .= "<div class='col-7'>check mb support</div>";
$html .= "<div class='col-5'>$mb</div>";
$html .= "<div class='col-7'>check gd support</div>";
$html .= "<div class='col-5'>$gd</div>";
$html .= "<div class='col-7'>zlib compression support</div>";
$html .= "<div class='col-5'>$zlib</div>";
$html .= "<div class='col-7'>XML support</div>";
$html .= "<div class='col-5'>$xml</div>";
$html .= "<div class='col-7'>curl support (Not required but external torrents may scrape faster)</div>";
$html .= "<div class='col-5'>$curl</div>";
$html .= "<div class='col-7'>openSSL (for the torrent encryption mod)</div>";
$html .= "<div class='col-5'>$openssl</div>";
$html .= "<div class='col-7'>bcmath support (Required for IPv6)</div>";
$html .= "<div class='col-5'>$bcmath</div>";
$html .= "<div class='col-7'>app/config/config.php</div>";
if (@file_exists('../config/config.php') && @is_writable(APPROOT.'/config/config.php')) {
   $html .= "<div class='col-5'><b><font color='red'>Writeable</font></b><br />Warning: leaving app/config/config.php writeable is a security risk</div>";
} else {
   $html .= "<div class='col-5'><b><font color='green'>Unwriteable</font></b></div>";
}
$html .= "<div class='col-7'>Document Root<br /><i><font size='1'>(Use this for your PATHS in app/config/config.php)</font></i></div>";
$html .= "<div class='col-5'>". str_replace('\\', '/', getcwd()) ."</div>";
$html .= "</div><br>";

$html .= "<div class='row p-3'>";
$html .= "<div class='col-6'>Directive</div>";
$html .= "<div class='col-3'>Reccommended</div>";
$html .= "<div class='col-3'>Actual</div>";
foreach ($php_recommended_settings as $phprec) {
   $html .= "<div class='col-6'>" . $phprec[0] . ":</div>";
   $html .= "<div class='col-3'>" . $phprec[2] . ":</div>";
   if (get_php_setting($phprec[1]) == $phprec[2]) {
       $settings = "green";
   } else {
$settings = "red";
   }
   $html .= "<div class='col-3'><font color='$settings'>".get_php_setting($phprec[1])."<font></div>";
}
$html .= "</div>";

return $html;
}

// Check DB
function check_db() {
$html = '';
try {
   $link = new PDO('mysql:host=' . $_POST['host'] . ';dbname=' . $_POST['dbname'], $_POST['dbuser'], $_POST['dbpass']);
   $link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
   $html = "<p class='text-center'><font color='#ff0000'><b>Failed to connect to database:</b></font></p> (%d) %s<br />" . $e->getMessage();
   return $html;
}

$arr = ["addedrequests","attachments","bans","bookmarks","bonus","blocks","categories","censor","clients","comments","completed"
,"countries","email_bans","faq","files","forumcats","forum_posts","forum_forums","forum_readposts"
,"forum_topics","friends","groups","guests","iplog","languages","likes","log","messages","news"
,"peers","pollanswers","polls","ratings","reports","requests","rules","snatched","shoutbox","staffmessages"
,"stylesheets","tasks","teams","thanks","tmdb","torrentlang","torrents","users","warnings"];

try {
   //$sql = file_get_contents('file.sql');
   $sql = "ALTER TABLE `torrents` ADD `aaaaaaaannouncelist` longtext DEFAULT NULL"; //for v3
   $install_db = $link->prepare($sql);
   $install_db->execute();
} catch (PDOException $e) {
   $html = "<p class='text-center'><font color='#ff0000'><b>Failed to insert to database:</b></font></p> (%d) %s<br />" . $e->getMessage();
   foreach ($arr as $table) :
       //$sql = "DROP TABLE IF EXISTS `$table`";
      // $install_db = $link->prepare($sql);
       //$install_db->execute();
       endforeach;
   return $html;
}
$html .= "<p class='text-center'><b>Check SQL Mode:</b><p>";
$stmt = $link->query("SHOW VARIABLES LIKE 'sql_mode'")->fetch();
if (!$stmt) {
   $html .= "<p class='text-center'><font color='#ff0000'><b>SQL Mode:</b></font> Error Getting SQL Mode</p><br><br>";
} else {
   $html .= "<p class='text-center'><font color='#00cc00'><b>SQL Mode:</b></font> $stmt[1] </p><br><br>";
}
   
$html .= "<p class='text-center'><b>Table Status Check:</b><p>";
$html .= "<div class='row'>";
$stmt = $link->prepare("SHOW TABLES");
$stmt->execute();
if (!$stmt) {
   $html .= "<font color='#ff0000'><b>Failed to list tables:</b></font>";
} else {
   $tables = array();
   while ($rr = $stmt->fetch()) {
       $tables[] = $rr[0];
   }
   foreach ($arr as $t) {
       if (!in_array($t, $tables)) {
           $html .= "<div class='col-2'>$t</div><div class='col-2'><font color='#ff0000'><b>MISSING</b></font></div>";
       } else {
           $html .= "<div class='col-2'>$t</div><div class='col-2'><font color='green'><b>OK</b></font></div>";
       }
   }
   $html .= "</div>";
}
$link = null;

return $html;

}

// Write config.php File
function write_config() {
$text = "<?php

// DB Details
define('DB_HOST', '".$_POST['DB_HOST']."');
define('DB_USER', '".$_POST['DB_USER']."');
define('DB_PASS', '".$_POST['DB_PASS']."');
define('DB_NAME', '".$_POST['DB_NAME']."');
define('DB_CHAR', 'utf8mb4');

// URL Root
define('URLROOT', '".$_POST['URLROOT']."');

// App Root
define('APPROOT', dirname(dirname(__FILE__)));

// Paths
define('BACUP', '../data/backups');
define('CACHE', '../data/cache');
define('LANG', '../data/languages');
define('LOGGER', '../data/logs');
define('UPLOADDIR', '../data/uploads');
define('EMAILDIR', '../data/email');

// Quick Time
define('TT_TIME', time());
define('TT_DATE', date('Y-m-d H:i:s'));

// Version
define('VERSION', 'PDO');

// File Charset
define('CHARSET', 'utf-8');

// Announcelist //seperate via comma
define('ANNOUNCELIST', URLROOT . '/announce.php');

// Default Block Layout
define('DEFAULT_LAYOUT', false);

// Passkey Url
define('PASSKEYURL', URLROOT . '/announce.php?passkey=%s');

// Can edit Settings
define('_OWNERS', array('".$_POST['_OWNERS']."')); // Example & with more define('_OWNERS', array('mjay', 'mjay', 'mjay'));

// Image upload settings
define('USE_WEBP', ".$_POST['USE_WEBP']."); // Use Webp
define('IMAGEMAXFILESIZE', 524288); // Max uploaded image size in bytes (Default: 512 kB)
define('ALLOWEDIMAGETYPES', array(
   'image/gif' => '.gif',
   'image/jpeg' => '.jpg',
   'image/jpg' => '.jpg',
   'image/png' => '.png',
));

// Hide Blocks On Pages
define('ISURL', array('login', 'logout', 'signup', 'contact', 'recover', 'recover/confirm'));

// category,name,dl,magnet,uploader,tube,tmdb,comments,nfo,size,completed,seeders,leechers,health,external,added,speed,wait,rating
define('TORRENTTABLE_COLUMNS', 'category,name,dl,magnet,uploader,tube,tmdb,comments,nfo,size,completed,seeders,leechers,health,external,added,speed,wait,rating,admin');

// Set User Group
define('_USER', 1);
define('_POWERUSER', 2);
define('_VIP', 3);
define('_UPLOADER', 4);
define('_MODERATOR', 5);
define('_SUPERMODERATOR', 6);
define('_ADMINISTRATOR', 7);

// Cat arrays
define('PopularCats', array(1)); // popular cat id for popular block
define('MovieCats', array('Film')); // movie cats eg array('Movies','MoviesHD')
define('SerieCats', array('TV')); // serie cat eg array('Anime','tv')

// TMDB
define('_TMDBAPIKEY', '".$_POST['_TMDBAPIKEY']."'); // Place Key Here ////////
define('_TMDBLANG', 'en'); // TMDB Language
define('_TMDBDEBUG', false); // TMDB Debug
define('_TMDBswitch', ".$_POST['_TMDBswitch']."); // TMDB On - Off
define('_OMDBAPIKEY', '".$_POST['_OMDBAPIKEY']."'); // Place Key Here ////////
define('_OMDBswitch', ".$_POST['_OMDBswitch']."); // TMDB On - Off ";
//file_put_contents('../app/config/newconfig.php', $text);
file_put_contents('backend/newconfig.php', $text); // for v3
}

// Get Step From Url
$step = (int) $_GET['step'] ?? 0;

if ($step == 0 || !$step) {
   // 0) check url
   $data = check_url();
   $data['instruction'] = "Welcome to install<br>is the url correct - $data[url]<br>";
   $data['form'] = 'Must not have / on end';
   $data['step'] = "<a href='$data[full_url]?step=1'>Next Step 1</a>";
} elseif ($step == 1) {
   // 1) check server
   $data['instruction'] = "Please check server config<br>";
   $data['form'] = check_enviroment();
   $data['step'] = "<a href='$_COOKIE[url]?step=2'>Next Step 2</a>";
} elseif ($step == 2) {
   // 2) enter db details
   $data['instruction'] = "enter database details";
   $form = "<form method='post' action='$_COOKIE[url]?step=3'>";
   $form .= "<input type='text' class='form-control' name='host' placeholder='host'><br>";
   $form .= "<input type='text' class='form-control' name='dbname' placeholder='dbname'><br>";
   $form .= "<input type='text' class='form-control' name='dbuser' placeholder='dbuser'><br>";
   $form .= "<input type='text' class='form-control' name='dbpass' placeholder='dbpass'><br>";
   $form .= "<div class='text-center'><input type=submit value='submit'></div>";
   $form .= "</form>";
   $data['form'] = $form;
   $data['step'] = "";
} elseif ($step == 3) {
   // 3) check db install
   $data['instruction'] = "check database details";
   if (!empty($_POST)) {
       $data['form'] = check_db();
   }
   $form .= "enter settings details";
   $form .= "<form method='post' action='$_COOKIE[url]?step=4'>";
   $form .= "<input type='hidden' name='host' value='$_POST[host]'>";
   $form .= "<input type='hidden' name='dbname' value='$_POST[dbname]'>";
   $form .= "<input type='hidden' name='dbuser' value='$_POST[dbuser]'>";
   $form .= "<input type='hidden' name='dbpass' value='$_POST[dbpass]'>";
   $form .= "<input type=submit value='submit'>";
   $form .= "</form>";
   $data['step'] = $form;
} elseif ($step == 4) {
   // 4) enter config settings
   $data['instruction'] = "check config file";
   $form .= "<form method='post' action='$_COOKIE[url]?step=5'>";
   $form .= "<div class='row'>";
   $form .= "<div class='col'>";
   $form .= "<dl class='row mb-0'>";
   $form .= "<dt class='col-sm-5'>Host</dt><dd class='col-sm-7'><input type='text' class='form-control' name='DB_HOST' value='$_POST[host]'></dd>";
   $form .= "<dt class='col-sm-5'>DB Username</dt><dd class='col-sm-7'><input type='text' class='form-control' name='DB_USER' value='$_POST[dbuser]'></dd>";
   $form .= "<dt class='col-sm-5'>DB Password</dt><dd class='col-sm-7'><input type='text' class='form-control' name='DB_PASS' value='$_POST[dbpass]'></dd>";
   $form .= "<dt class='col-sm-5'>DB Name</dt><dd class='col-sm-7'><input type='text' class='form-control' name='DB_NAME' value='$_POST[dbname]'></dd>";
   $form .= "<dt class='col-sm-5'>Site Url</dt><dd class='col-sm-7'><input type='text' class='form-control' name='URLROOT' 'http://localhost/M-BiTsy'></dd>";
   $form .= "<dt class='col-sm-5'>Owner</dt><dd class='col-sm-7'><input type='text' class='form-control' name='_OWNERS'></dd>";
   $form .= "<dt class='col-sm-5'>Use Webp</dt><dd class='col-sm-7'><input type='text' class='form-control' name='USE_WEBP'></dd>";
   $form .= "<dt class='col-sm-5'>TMDB API Key</dt><dd class='col-sm-7'><input type='text' class='form-control' name='_TMDBAPIKEY'></dd>";
   $form .= "<dt class='col-sm-5'>TMDB API Key On</dt><dd class='col-sm-7'><input type='text' class='form-control' name='_TMDBswitch'></dd>";
   $form .= "<dt class='col-sm-5'>OMDB API Key</dt><dd class='col-sm-7'><input type='text' class='form-control' name='_OMDBAPIKEY'></dd>";
   $form .= "<dt class='col-sm-5'>OMDB API Key On</dt><dd class='col-sm-7'><input type='text' class='form-control' name='_OMDBswitch'></dd>";
   $form .= "<div class='text-center'><input type=submit value='submit'></div></dd>";
   $form .= "</div>";
   $form .= "</div>";
   $form .= "</form>";
   $data['form'] = $form;
   $data['step'] = "";
} elseif ($step == 5) {
   // 5) write config settings
   write_config();
   $data['instruction'] = "check config file";
   $data['form'] = 'Now Signup';
   $data['step'] = "";
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
 <title>Install</title>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>

<nav class="navbar bg-primary p-2">
 <p class='text-light'>M-BiTsy Install</p>
</nav><br>

<div class="container justify-content-md-center-2 p-2" style='background-color:aquamarine;color:blue;border:3px solid blue;'>
<p class='text-center'><?= $data['instruction'] ?></p>
<p class='text-center'><?= $data['form'] ?></p>
<p class='text-center'><?= $data['step'] ?></p>
</div><br>

<footer class="bg-primary fixed-bottom p-2">
 <p class='text-center text-light'>Support @<a href='' style='color:yellow'>Torrent Trader</a></p>
</footer>

</body>
</html>


in line 117 we write new column to torrents table for demo but i do full db file
    //$sql = file_get_contents('file.sql');
   $sql = "ALTER TABLE `torrents` ADD `atest` longtext DEFAULT NULL"; //for v3
Birthday V3 — 2022-12-17 18:44:30 in v3 Mods Requests
try max & min in html
in example only 16 - 96 allowed
<input type="date" name="birthday" max="1929-12-29"  min="2006-12-02">
shoutbox history — 2022-12-17 15:02:16 in General Chat
If you just want to show more messages just change the limit here in shoutbox.php
query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT 20';
Scrape external for seeder/leechers for v3
Scrape on torrents-upload.php & torrent-details.php
if internal with multiple trackers remove if here
	if ($external=='yes' && $site_config['UPLOADSCRAPE']){
ScrapeId($id, $annlist, $infohash);
}


SQL to store announcelist
ALTER TABLE `torrents` ADD `announcelist` longtext DEFAULT NULL;


in backend/functions.php
find
require_once(BACKEND."/mysql.class.php");


below add
	require_once("backend/scraper.php");


add scrape function
function ScrapeId($id, $annlist, $infohash)
{
$scraper = new Scraper();
try {
$scraped = $scraper->scrape($infohash, $annlist, 20, 4, true );
}  catch (Exception $e) {
$json = json_encode($e);
show_error_msg(T_("ERROR"), $json, 1);
}

$myarray = array_shift($scraped);

$seeders = $leechers = $completed = 0;
if ($myarray['seeders'] > 0) {
$seeders = $myarray['seeders'];
}
if ($myarray['leechers'] > 0) {
$leechers = $myarray['leechers'];
}
if ($myarray['completed'] > 0) {
$completed = $myarray['completed'];
}

if ($seeders !== 0) {
SQL_Query_exec("UPDATE torrents SET leechers='".$leechers."', seeders='".$seeders."',times_completed='".$completed."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$id."'");
} else {
show_error_msg(T_("ERROR"), 'error or dead torrent', 1);
}

return $myarray;
}


in torents-upload.php
find
	//EXTERNAL SCRAPE	
if ($external=='yes' && $site_config['UPLOADSCRAPE']){
$tracker=str_replace("/announce","/scrape",$announce);
$stats = torrent_scrape_url($tracker, $infohash);
$seeders = (int) strip_tags($stats['seeds']);
$leechers = (int) strip_tags($stats['peers']);
$downloaded = (int) strip_tags($stats['downloaded']);
SQL_Query_exec("UPDATE torrents SET leechers='".$leechers."', seeders='".$seeders."',times_completed='".$downloaded."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$id."'");
}
//END SCRAPE

replace with
	//EXTERNAL SCRAPE
if ($external=='yes' && $site_config['UPLOADSCRAPE']){
ScrapeId($id, $annlist, $infohash);
}
//END SCRAPE


add $announcelist & add to torrent insert on end
	$announce_list = serialize($annlist);
$ret = SQL_Query_exec("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action, announcelist) VALUES (".sqlesc($fname).", '".$CURUSER['id']."', ".sqlesc($name).", ".sqlesc($descr).", '".$inames[0]."', '".$inames[1]."', '".$catid."', '" . get_date_time() . "', '".$infohash."', '".$torrentsize."', '".$filecount."', ".sqlesc($fname).", '".$announce."', '".$external."', '".$nfo."', '".$langid."','$anon', '".get_date_time()."', '$announce_list')");


in torrent-details.php find
if ($scrape =='1'){
print("<td valign='top' align='right'><b>Tracked: </b>EXTERNAL<br /><br />");
$seeders1 = $leechers1 = $downloaded1 = null;

$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
while ($trow = mysqli_fetch_assoc($tres)) {
$ann = $trow["url"];
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = preg_replace("/^announce/", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;

if ($oldpath == $path) {
continue; // Scrape not supported, ignored
}

// TPB's tracker is dead. Use openbittorrent instead
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) {
$tracker = "http://tracker.openbittorrent.com/scrape";
}

$stats = torrent_scrape_url($tracker, $row["info_hash"]);
if ($stats['seeds'] != -1) {
$seeders1 += $stats['seeds'];
$leechers1 += $stats['peers'];
$downloaded1 += $stats['downloaded'];
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
} else {
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

}
}

if ($seeders1 !== null){ //only update stats if data is received
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("Seeders: ".number_format($seeders1)."<br />");
print ("Leechers: ".number_format($leechers1)."<br />");
print (T_("COMPLETED").": ".number_format($downloaded1)."<br />");

SQL_Query_exec("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."', times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");
}else{
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("<font color='#ff0000'>Tracker Timeout<br />Please retry later</font><br />");
}

print ("<form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"Update Stats\" /></form></td>");
}else{
print ("<td valign='top' align='right'><b>Tracked:</b> EXTERNAL<br /><br /><form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"Update Stats\" /></form></td>");
}


replace with
		if ($scrape =='1'){
print("<td valign='top' align='right'><b>Tracked: </b>EXTERNAL<br /><br />");
$annlist = unserialize($row['announcelist']);
$stat = ScrapeId($id, $annlist, $row['info_hash']);
$seeders1 = $stat['seeders'] ?? 0;
$completed1 = $stat['completed'] ?? 0;
$leechers1 = $stat['leechers'] ?? 0;

if ($stat['seeders'] !== null){ //only update stats if data is received
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("Seeders: ".number_format($seeders1)."<br />");
print ("Leechers: ".number_format($leechers1)."<br />");

SQL_Query_exec("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."', times_completed='".$completed1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");
}else{
print ("<b>".T_("LIVE_STATS").": </b><br />");
print ("<font color='#ff0000'>Tracker Timeout<br />Please retry later</font><br />");
}

print ("<form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"Update Stats\" /></form></td>");
}else{
print ("<td valign='top' align='right'><b>Tracked:</b> EXTERNAL<br /><br /><form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"Update Stats\" /></form></td>");
}


add announcelist to big select query
eg
$res = SQL_Query_exec("SELECT torrents.announcelist,  torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id");


place scraper file in backend folder

Fully tested on v3
Quote:
update the external peers

do you scrape on upload ? this is rough guide for best way to scrape multi - see if you have luck with this but debugging can be pain because of server settings

for multi announce you can use this https://github.com/medariox/scrapeer
place in backend
then on torrents-upload.php
require "backend/scraper.php";

find
	if ($external=='no')
$message = sprintf( T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id );
else
$message = sprintf( T_("TORRENT_UPLOAD_EXTERNAL"), $name, $id );
show_error_msg(T_("UPLOAD_COMPLETE"), $message, 1);


replace with - this assumes internal as external but for test use external
	if ($external=='no')
$message = sprintf( T_("TORRENT_UPLOAD_LOCAL"), $name, $id, $id );
else
$message = sprintf( T_("TORRENT_UPLOAD_EXTERNAL"), $name, $id );
show_error_msg(T_("UPLOAD_COMPLETE"), $message, 1);
ScrapeId($id, $annlist, $infohash);


backend functions.php add
function ScrapeId($id, $annlist, $infohash)
   {
       $scraper = new Scraper();
       $scraped = $scraper->scrape($infohash, $annlist, 20, 4, true );

       $myarray = array_shift($scraped);

       $seeders = $leechers = $completed = 0;
       if ($myarray['seeders'] > 0) {
           $seeders = $myarray['seeders'];
       }
       if ($myarray['leechers'] > 0) {
           $leechers = $myarray['leechers'];
       }
       if ($myarray['completed'] > 0) {
           $completed = $myarray['completed'];
       }

       if ($seeders !== 0) {
          die('something happened so update db');
       } else {
           die('error or dead torrent');
       }
   }
interesting work 👍 going to test some uploads on qbittorrent side how's this implemented
maybe the bencode class if yours is different
just reading through bep now is function to add multiple internal backup announces ?

Quote:
On each announce, first try tracker1, then if that cannot be reached, try backup1 and backup2 respectively.

On download you would still point to 1 announce.php ? so for internal would you add  3  trackers on client if so that would possible be announce-list instead of announce

Quote:
If the client is compatible with the multitracker specification, and if the "announce-list" key is present, the client will ignore the "announce" key and only use the URLs in "announce-list".

first thought was edit file somewhere else importing announce array on upload or details etc serialized into database do you want to scrape multi internal trackers because we then can simply edit file and pass to scraper

this is opened up some ideas just hoping the clients can do the leg work here

result on qbit adding multiple trackers on qbit when creating torrent
announce-
Quote:

edit
was going to call myself stupid why would you scrape your own site multiple times but then the a little voice in back of my head spoke
who said there all had to be internal ??? lol
on TT you most use announce (site_config) to upload internal but in the trackers on client side if you had 3 sites you could add all 3 on create torrent and scrape all 3
this is on upload from parse function
$TorrentInfo[6] = $array["announce-list"];

from this way the only issue would be this on torrents-upload.php
eg $site_config['announce_list'] = "$site_config[SITEURL]/announce.php, 'other', 'other1'";
	if (!in_array($announce, $announce_urls, 1)){
$external='yes';
   }else{
$external='no';
}

internal or external depends on implmentation and what backup announces
signature — 2022-12-13 05:18:03 in v3 Support
try this
signature — 2022-12-08 16:44:55 in v3 Support
Post your account.php
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728