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

Cheat on download — 2020-07-15 14:57:14 in v3 Support
You can block libtorrent altogether or match version as this is what they use and myself.

Blocking a single VPN IP won’t do any good as they probably cycle block ranges on the IP list upon a number of connection failures if it’s a good VPN client.

I use a seed box. If a user is using “Gods Downloader PRO” to download a torrent and by that time they are in the peer table, I can block that name and they can’t as easily change client name and version reported back unless they made the client themselves or compiled from Github sources and modified the string responsible.

So now they have to give up that client and use another. Now they open their VPN and use uTorrent. Now we see same IP under another client. What do we do from here?

We start banning emails associated with user. We compile a list of public “disposable email providers” by domain and pack that to the hilt. Now we play a guessing game of cat and mouse.

Vicious cycle.

The point is, it’s not even worth it. You will spend more energy going after 1 user or public peer while people could be dumping your database and you had no idea. Unless this is destroying your monthly seedbox storage allowance, I would personally let it be.

I have 20K almost now, and I see some weird sh** at times but I will never go after the 1% that found some program to download to 5% that removes the tracker following further completion.
Thanks so much for this. This ratio hole is very real and it’s happening like crazy for me. Much appreciated.
Cheat on download — 2020-07-15 12:27:52 in v3 Support
Actually no, you can add a query to cleanup that checks peer table for client names and ban if string matches an array or $site_config list of banned clients.

I have not actually thought to do this, so I’ll get it posted. It’s useful for me too.

We can match in query with a LIKE or CONTAINS clause.

With this query, you can do all kinds of things to the user ID.. ban them, warn them, send a PM that says your not impressed, etc etc
So far this is done for account-signup.php, I have many area's to add this to. This replaces the old sendmail() email function, providing you HTML email templates
that let you pull more data or personalize better for users. Plain text is boring.

This sends a HTML welcome email to new user.

Required: PEAR Mail

https://pear.php.net/manual/en/package.mail.mail.factory.php

PEAR mail is excellent, I've been using it since our first 20 members (reaching 20K now) and its never failed once. I recommend it in general over sendmail.

Install:

Here are Linux instructions. I don't use Linux and I don't know it very well, but this will install under "Ubuntu". Install each line individually starting from top:

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo apt-get install php-pear[/color]

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo pear install mail[/color]

[color=rgb(44, 130, 201)]#[/color] [color=rgb(226, 80, 65)]sudo pear install Net_SMTP[/color]

Now, open account-signup.php and find


//send pm to new user
   if ($site_config["WELCOMEPMON"]){
       $dt = sqlesc(get_date_time());
       $msg = sqlesc($site_config["WELCOMEPMMSG"]);
       SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES(0, $id, $dt, $msg, 0)");
   }


Add after


if ($site_config["WELCOMEEMAIL"]) {
   require_once "Mail.php";
   $from    = $site_config['SITENAME'] . " <" . $site_config['SITEEMAIL'] . ">";
   $subject = "Welcome to " . $site_config['SITENAME'];
   $headers = array(
       'To' => $email,
       'From' => $from,
       'Subject' => $subject,
       'MIME-Version' => 1,
       'Content-type' => 'text/html;charset=iso-8859-1'
   );
   $smtp    = Mail::factory('smtp', array(
       'host' => $site_config["mail_smtp_host"],
       'auth' => $site_config["mail_smtp_auth"],
       'username' => $site_config["mail_smtp_user"],
       'password' => $site_config["mail_smtp_pass"]
   ));
   $mail    = $smtp->send($email, $headers, $site_config["WELCOMEEMAILBODY"]);
   // Log send error
   if (PEAR::isError($mail)) {
       write_log($mail->getMessage());
       return false;
   } else {
       write_log("Welcome Email successfully sent to " . $email);
   }
}


Now open backend/config.php and add


$site_config['WELCOMEEMAIL'] = true;
$site_config['WELCOMEEMAILBODY']  = '
<html>
<head>
<style>body{font-family:arial,sans-serif,helvetica;background-color:rgba(236,236,236,1);margin:0;padding:0}.email-header{background:width:100%;height:56px;margin-bottom:20px}.email-body{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);background:rgba(255,255,255,1);padding:10 10px 50px 10px;font-size:17px;width:90%;margin:0 auto;text-align:center;overflow:auto}.welcome-msg{font-size:30px;text-align:center;padding:0 20px 20px 0}.welcome-msg2{font-size:17px;text-align:center;padding:0 20px 20 0}.email-body .welcome-msg{padding-top:15px}.email-body a{margin-left:-20px;margin-top:10px}.btn-signin{box-shadow:inset 0 1px 0 0 rgba(242,156,147,1);background:linear-gradient(to bottom,rgba(254,26,0,1) 5%,rgba(206,1,0,1) 100%);background-color:rgba(254,26,0,1);border-radius:6px;border:1px solid rgba(216,53,38,1);display:inline-block;cursor:pointer;color:rgba(255,255,255,1);font-family:Arial;font-size:15px;font-weight:bold;padding:6px 24px;text-decoration:none;text-shadow:0 1px 0 rgba(178,62,53,1)}.btn-signin:hover{background:linear-gradient(to bottom,rgba(206,1,0,1) 5%,rgba(254,26,0,1) 100%);background-color:rgba(206,1,0,1)}.btn-signin:active{position:relative;top:1px}</style>
</head>
<body>
<div class="email-header">
</div>
<div class="welcome-msg">Welcome!</div>
<div class="welcome-msg2">Your account has been activated.</div>
<div class="email-body">
<div class="welcome-msg">Your only movie torrents!</div>
<div class="email-content">
This is my email body. Text will go here.
</div>
<div class="welcome-msg">Sign In</div>
<a href="https://TRACKER.com/signin/" class="btn-signin">Sign In</a>
</div>
</body>
</html>';
Announce - BIGINT Errors — 2020-07-15 06:41:12 in v3 Support
"mostvotedplaya, post: 68800, member: 20335":

[url='https://dev.mysql.com/doc/refman/8.0/en/integer-types.html']BIGINT[(M)] [UNSIGNED] [ZEROFILL][/url]

A large integer. The signed range is-9223372036854775808 to9223372036854775807. The unsigned range is 0to 18446744073709551615.

just check the fields are above 0 for subtraction, because unsigned prevent anything Lower than 0


INT(50) currently, which seems wrong to me in terms of field type. My second attempt using CAST() - not advised but a cheat more so:


////////////////// NOW WE DO THE TRACKER EVENT UPDATES ///////////////////

if ($event == "stopped") { // UPDATE "STOPPED" EVENT
       SQL_Query_exec("DELETE FROM peers WHERE $selfwhere");
       if (mysql_affected_rows()){
           if ($self["seeder"] == "yes")
               $updateset[] = "seeders = seeders - CAST(1 AS SIGNED)";
           else
               $updateset[] = "leechers = leechers - CAST(1 AS SIGNED)";
       }
}

if ($event == "completed") { // UPDATE "COMPLETED" EVENT  
   $updateset[] = "times_completed = times_completed + CAST(1 AS SIGNED)";

   if ($MEMBERSONLY)
       SQL_Query_exec("INSERT INTO completed (userid, torrentid, date) VALUES ($userid, $torrentid, '".get_date_time()."')");
}//END COMPLETED

if (isset($self)){// NO EVENT? THEN WE MUST BE A NEW PEER OR ARE NOW SEEDING A COMPLETED TORRENT
 
   SQL_Query_exec("UPDATE peers SET ip = " . sqlesc($ip) . ", passkey = " . sqlesc($passkey) . ", port = $port, uploaded = $uploaded, downloaded = $downloaded, to_go = $left, last_action = '".get_date_time()."', client = " . sqlesc($agent) . ", seeder = '$seeder' WHERE $selfwhere");

   if (mysql_affected_rows() && $self["seeder"] != $seeder){
       if ($seeder == "yes"){
           $updateset[] = "seeders = seeders + CAST(1 AS SIGNED)";
           $updateset[] = "leechers = leechers - CAST(1 AS SIGNED)";
       } else {
           $updateset[] = "seeders = seeders - CAST(1 AS SIGNED)";
           $updateset[] = "leechers = leechers + CAST(1 AS SIGNED)";
       }
   }

} else {

   $ret = SQL_Query_exec("INSERT INTO peers (connectable, torrent, peer_id, ip, passkey, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, client) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", " . sqlesc($passkey) . ", $port, $uploaded, $downloaded, $left, '".get_date_time()."', '".get_date_time()."', '$seeder', '$userid', " . sqlesc($agent) . ")");
 
   if ($ret){
       if ($seeder == "yes")
           $updateset[] = "seeders = seeders + CAST(1 AS SIGNED)";
       else
           $updateset[] = "leechers = leechers + CAST(1 AS SIGNED)";
   }
}

//////////////////    END TRACKER EVENT UPDATES ///////////////////
[/PHP]
Cheat on download — 2020-07-15 06:39:02 in v3 Support
I get these in my peer list, client agent response of "Direct Downloader", "Accelerator" etc. You can ban clients in admincp no?
AJAX Polls v1 — 2020-07-15 04:48:52 in v3 Mods Completed
Here I developed AJAX Polls, for TT. It is quite easy and I've done the code and testing so all is well.

How it works: User is presented with Poll. Radio fields with choices are displayed. They vote, and they get a success
message, it automatically switches to results (no refresh happening at all here).

The old one was bloated, old and made no sense for the routines accomplishing exactly the code below. So we replace.

First, create ajax_polls_get.php


<?
// AJAX Polls - GET (title, description, options & votes : id) - July 12, 2020
try {
$dsn      = 'mysql:dbname=database;host=localhost';
$user = 'username';
$password = 'password';
$conn = new PDO($dsn, $user, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (PDOException $e) {
  die('Unable to connect to database');
}
$stmt = $conn->prepare("SELECT polls.id, polls.title, polls.desc, poll_answers.id AS answer, poll_answers.poll_id, poll_answers.title, poll_answers.votes AS votes FROM polls LEFT JOIN poll_answers ON polls.id = poll_answers.poll_id");
$stmt->execute();
$pollData = array();
if ($stmt->rowCount() > 0) {
   $poll = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($poll as $row => $data) {
       $data['id']             = $row['id'];
       $data['poll_id']         = $row['poll_id'];
       $data['title']             = $row['title'];
       $data['votes']             = $row['votes'];
       $data['answer']         = $row['answer'];
       array_push($pollData, $poll);
   }
}
echo json_encode($poll, JSON_UNESCAPED_SLASHES);


Next, create ajax_polls_post.php


<?
// AJAX Polls - POST (userid ? poll_answer : id) - July 12, 2020
try {
$dsn      = 'mysql:dbname=database;host=localhost';
$user = 'username';
$password = 'password';
$conn = new PDO($dsn, $user, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
}
catch (PDOException $e) {
  die('Unable to connect to database');
}
if (isset($_POST['userid'])) {
   $stmt = $conn->prepare('SELECT * FROM polls');
   $stmt->execute();
   $poll = $stmt->fetch(PDO::FETCH_ASSOC);
   if ($poll) {
       $stmt = $conn->prepare('SELECT * FROM poll_answers WHERE poll_id = :id');
       $stmt->bindParam(":id", $_POST['id'], PDO::PARAM_INT);
       $stmt->execute();
       $poll_answers = $stmt->fetchAll(PDO::FETCH_ASSOC);
       if (isset($_POST['poll_answer'])) {
           $stmt = $conn->prepare('UPDATE poll_answers SET votes = votes + 1 WHERE id = :answer');
           $stmt->bindParam(":answer", $_POST['poll_answer'], PDO::PARAM_INT);
           $stmt->execute();
           $user = "UPDATE users SET poll_voted = 'yes' WHERE id = :userid";
           $stmt = $conn->prepare($user);
           $stmt->bindParam(":userid", $_POST['userid'], PDO::PARAM_INT);
           $stmt->execute();
           echo "<div id=\"recent-poll\"></div>"; // Retrieve poll results
       }
   } else {
       die('Poll ID does not exist.');
   }
} else {
   die('User ID does not exist.');
}
?>


Delete or Backup the old poll tables. Now execute query


CREATE TABLE `poll_answers` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `poll_id` int(11) NOT NULL,
 `title` text NOT NULL,
 `votes` int(11) NOT NULL DEFAULT 0,
 PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

CREATE TABLE `polls` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `title` text NOT NULL,
 `desc` text NOT NULL,
 PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

ALTER TABLE users ADD poll_voted ENUM('no','yes') NOT NULL;


Now add to header.php


<script>
// AJAX Polls - POST
$(function (e) {});
$("#form-poll").on('submit', (function (e) {
   e.preventDefault();
   $.ajax({
       url: "/ajax/ajax_polls_post.php",
       type: "POST",
       data: new FormData(this),
       contentType: false,
       cache: false,
       processData: false,
       beforeSend: function () {
           $("#poll-msg").fadeIn();
           $("#vote-err").fadeOut();
       },
       success: function (data) {
           if (data == 'invalid') {
               // Invalid choice
               $("#vote-err").html("Invalid vote").fadeIn();
           } else {
               // Poll success
               $(".content").fadeOut();
               $("#vote-success").html("Vote submitted.").delay(1000).fadeIn().delay(2000).fadeOut();
               $("#poll-results-title").fadeIn();
               // Retrieve poll results
               $("#refresh-poll").html(data).fadeIn();
           }
       },
       error: function (e) {
           $("#vote-err").html(e).fadeIn();
       }
   });
}));

// Round votes (bar width)
function roundVotes(votes) {
   return Math.round(votes * 1) * 10;
}

// AJAX Polls - GET
function fetchPollData() {
   $(function(){});
       $.ajax({
           url: "/ajax/ajax_polls_get.php",
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               $.each(data, function (i, item) {
                   html_to_append +=
                       '<div class="content poll-result"><div class="wrapper"><div class="poll-question"><p>' +
                       item.title +
                       ' - <span style="font-weight:bold">' + item.votes + ' Votes</span></p><div class="result-bar" style="width:' + roundVotes(item.votes) + '%">' + item.votes + ' Votes</div></div></div></div>';
               });
               $("#recent-poll").html(html_to_append);
           }
       });
}
fetchPollData();
setInterval(function () {
   fetchPollData()
}, 10000);
</script>


Now this is the full piece of go into a block or footer.php - I don't know your template - please request block or footer in comments and I will update the code.


<? if ($CURUSER && $CURUSER["poll_voted"] == "yes"){ ?>

<!-- Live Voting AJAX : Already Voted (View Votes) -->
<div id="recent-poll"></div>

<? } elseif ($CURUSER) { ?>

<!-- Live Voting : Options -->
<?
try {
$dsn      = 'mysql:dbname=database;host=localhost';
$user     = 'username';
$password = 'password';
$conn     = new PDO($dsn, $user, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (PDOException $e) {
  die('Unable to connect to database');
}
$stmt = $conn->prepare('SELECT * FROM polls');
$stmt->execute();
$poll = $stmt->fetch(PDO::FETCH_ASSOC);
if ($poll) {
   $stmt = $conn->prepare('SELECT * FROM poll_answers');
   $stmt->execute();
   $poll_answers = $stmt->fetchAll(PDO::FETCH_ASSOC);
} else {
   die('Poll does not exist.');
}
?>

<h1>Poll: <?=$poll['title']?></h1>

<div class="content poll-vote">
   <form action="/ajax/ajax_polls_post.php" method="post" id="form-poll">
       <fieldset>
               <? for ($i = 0; $i < count($poll_answers); $i++): ?>
                   <input type="radio" name="poll_answer" id="<?=$poll_answers[$i]['id']?>" value="<?=$poll_answers[$i]['id']?>"<?=$i == 0 ? ' checked' : ''?>>
                   <label for="<?=$poll_answers[$i]['id']?>">
                   <?=$poll_answers[$i]['title']?>
                   </label>
               <? endfor; ?>
               <div>
                   <input type="submit" value="Vote">
                   <a href="/result.php?id=<?=$poll['id']?>">View Result</a>
               </div>
       </fieldset>
   <input type="hidden" name="userid" value="<? echo $CURUSER['id']; ?>">
   </form>
</div>

<!-- Events -->
<div id="vote-success"></div>
<div id="vote-err"></div>
<div id="poll-msg"></div>
<div id="refresh-poll"></div>

<? } ?>


Lastly, add to styles.css


.poll-vote form {
     display: flex;
     flex-flow: column;
}
.poll-vote form label {
     padding-bottom: 10px;
}
.poll-vote form input[type="radio"] {
     transform: scale(1.1);
}
.poll-vote form input[type="submit"], .poll-vote form a {
     display: inline-block;
     padding: 8px;
     border-radius: 5px;
     background-color: #38b673;
     border: 0;
     font-weight: bold;
     font-size: 14px;
     color: #FFFFFF;
     cursor: pointer;
     width: 150px;
     margin-top: 15px;
}
.poll-vote form input[type="submit"]:hover, .poll-vote form a:hover {
     background-color: #32a367;
}
.poll-vote form a {
     text-align: center;
     text-decoration: none;
     background-color: #37afb7;
     margin-left: 5px;
}
.poll-vote form a:hover {
     background-color: #319ca3;
}
.poll-result .wrapper {
     display: flex;
     flex-flow: column;
}
.poll-result .wrapper .poll-question {
     width: 50%;
     padding-bottom: 5px;
}
.poll-result .wrapper .poll-question p {
     margin: 0;
     padding: 5px 0;
}
.poll-result .wrapper .poll-question p span {
     font-size: 14px;
}
.poll-result .wrapper .poll-question .result-bar {
     display: flex;
     height: 25px;
     min-width: 30%;
     max-width: 475px;
     background-color: #266F30;
     border-radius: 5px;
     font-size: 14px;
     color: #FFFFFF;
     justify-content: center;
     align-items: center;
}


[ATTACH type="full"]5629[/ATTACH]

[ATTACH type="full"]5630[/ATTACH]

AS votes increase so will the length of the bar. This is due to the JS function I added roundVote(). Enjoy!  ? :alien:
TT Torrent Client — 2020-07-11 20:04:03 in v3 Mods Completed
Downloading this way doesn’t put you into peer list, so maybe we should query to work with peers table?

Security:
Im going to create another hidden input, this time with a unique key that each user will have in a column, that way no one can modify the form and use any userid. If both fail check, hammering requests at the script won’t do very much with die() either. It will have to check both and if successful, will continue like normal.

I can turn on Rate Limiting anytime, but not everyone is on a DNS provider with this functionality.

I’ll update post for extra SQL column, and user/key check.
I do everything by binded prepared statements, just my pref. I’ll do it over in morning
TT Torrent Client — 2020-07-11 04:53:19 in v3 Mods Completed
First, create ajax_dl_progress.php


<?
// TT Torrent Client v1
// STorrents2020 @TorrentTrader.xyz
try {
   $dsn      = 'mysql:dbname=database;host=localhost';
   $user     = 'username';
   $password = 'password';
   $stmt     = new PDO($dsn, $user, $password);
   $stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$userid = isset($_GET['userid']) ? intval($_GET['userid']) : 0;
$stmt   = $conn->prepare("SELECT id, download_perc, download_peers, download_speed, download_status, download_conn FROM users WHERE id = :userid");
$stmt->bindParam(":userid", $userid, PDO::PARAM_INT);
$stmt->execute();
$progressdata = array();
if ($stmt->rowCount() > 0) {
   $transfer = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($transfer as $row => $data) {
       $data['id']              = $row['id'];
       $data['value']           = $row['download_perc'];
       $data['download_peers']  = $row['download_peers'];
       $data['download_speed']  = $row['download_speed'];
       $data['download_status'] = $row['download_status'];
       $data['download_conn'] = $row['download_conn'];
       array_push($progressdata, $transfer);
   }
}
echo json_encode($usersactive);
?>


Open header.php and add


<script>
function fetchDownloadProgress() {
   $(document).ready(function () {
       $.ajax({
           url: 'ajax_dl_progress.php?userid=<? echo $CURUSER["id"]; ?>',
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
           
$.each(data, function (i, item) {
                   html_to_append +=
                       '<div style="padding-left:15px;padding-top:20px"><span style="font-size:25px"><i class="material-icons" style="color:#E72225;font-size:35px;vertical-align:bottom;padding-right:10px">cloud_download</i>' +
                       item.download_perc +
                       '</span><span style="font-size:25px;padding-left:20px"><i class="material-icons" style="color:rgba(46,168,4,1);font-size:35px;vertical-align:bottom;padding-right:10px">face</i>' +
                       item.download_peers +
                       '</span><span style="font-size:25px"><span style="font-size:25px;padding-left:20px"><i class="material-icons" style="color:#FFCE00;font-size:35px;vertical-align:bottom;padding-right:10px">flash_on</i>' +
                       item.download_speed +
                       '</span><span style="font-size:25px"><span style="font-size:25px;padding-left:20px"><i class="material-icons" style="color:#C0C0C0;font-size:35px;vertical-align:bottom;padding-right:10px">restore</i>' +
                       item.download_status +
                       '</span><div><span style="font-size:25px"><span style="font-size:25px"><i class="material-icons" style="color:#C0C0C0;font-size:35px;vertical-align:bottom;padding-right:10px">people</i>' +
                       item.download_conn +
                       '</span></div></div>';
               });
               $("#download-progress").html(html_to_append);
           }
       });
   });
}
fetchDownloadProgress();
setInterval(function () {
   fetchDownloadProgress()
}, 5000);
</script>


Open torrents-details.php and find


print ("<a href=\"../download/?id=$id&amp;name=" . rawurlencode($row["filename"]) . "\"><button type='button' class='btn btn-large btn-danger'>DOWNLOAD TORRENT</button></a>
<a href=\"../download/?id=$id&amp;name=" . rawurlencode($row["filename"]) . "\"></a><br />");


And replace with


print ("<a href=\"../download/?id=$id&amp;name=" . rawurlencode($row["filename"]) . "\"><button type='button' class='btn btn-large btn-danger'>DOWNLOAD TORRENT</button></a>
<a href=\"../download/?id=$id&amp;name=" . rawurlencode($row["filename"]) . "\"></a><br />");
print("<form method='get' action='/client'><input type='button'  class='btn btn-large ban-danger' value='Direct Download' onclick='this.form.submit();'><input type='hidden' name='id' value='$id'><input type='hidden' name='userid' value='$CURUSER[id]'></form>");


Run following queries


ALTER TABLE users ADD download_perc VARCHAR(5);
ALTER TABLE users ADD download_peers VARCHAR(10);
ALTER TABLE users ADD download_speed VARCHAR(10);
ALTER TABLE users ADD download_status TEXT(20);
ALTER TABLE users ADD download_conn TEXT(100);


Add anywhere you wish users to see their Direct Download progress


<!-- Direct Download AJAX response -->
<div id="download-progress"></div>


Now open /client/index.php and edit the following to match your database details


   try {
       $dsn      = 'mysql:dbname=database;host=localhost';
       $user     = 'username';
       $password = 'password';
       $stmt     = new PDO($dsn, $user, $password);
       $stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   }




Events I've added into database, and add more as I go. UDP connection info can be for admin, I just added so I know its working.

[ATTACH type="full" alt="starting.png"]5621[/ATTACH]

[ATTACH type="full" width="740px" alt="checking.png"]5622[/ATTACH]

[ATTACH type="full" alt="Downloading.png"]5624[/ATTACH]

[ATTACH type="full" width="743px" alt="ReqPieces.png"]5625[/ATTACH]

Lastly, upload ZIP to root / of web directory
dork(), hacker_dork() ?? Are these static or public functions?
That can be about 6-7 lines if I’m correct, and that query work can be LEFT JOINED in one line, binding all of it together with AS and such.

What are you looking for, mysqli or PDO?
AJAX User Activity — 2020-07-09 07:50:57 in v3 Mods Completed
Show user activity live on site (or in admin panel page) live activity. Something I started to work on, seems to fit nice.

Create [color=rgb(226, 80, 65)]ajax_useractivity.php[/color]


<?php
// AJAX User Activity - Queried by interval - July 9, 2020
try {
   $dsn      = 'mysql:dbname=database;host=localhost';
   $user     = 'username';
   $password = 'password';
   $stmt     = new PDO($dsn, $user, $password);
   $stmt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$idlist = '1,6'; // Exclude User ID from activity by comma - 1: admin, 6: dummy - no spaces!
$stmt = $conn->prepare("SELECT id, username, avatar, page AS activity, class FROM users WHERE id NOT IN (:exclude) ORDER BY last_access DESC LIMIT 8");
$stmt->bindParam(":exclude", $idlist, PDO::PARAM_STR);
$stmt->execute();
$userData = array();
if ($stmt->rowCount() > 0) {
   $usersactive = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($usersactive as $row => $data) {
       $data['id']       = $row['id'];
       $data['value']    = $row['username'];
       $data['avatar']   = $row['avatar'];
       $data['activity'] = $row['activity'];
       $data['class']    = $row['class'];
       array_push($userData, $usersactive);
   }
}
echo json_encode($usersactive);
?>


Add to header.php


<script>
function fetchUserActivity() {
   $(document).ready(function () {
       $.ajax({
           url: "ajax_useractivity.php",
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               $.each(data, function (i, item) {
                   html_to_append +=
                       '<a title="' + item.username + '" href="/user/?id=' + item.id + '"><img style="width:45px;height:45px;border-radius:50%;margin-right:10px;" src="' + item.avatar + '" /></a><div>' + item.activity + '</div>';
               });
               $("#user-activity").html(html_to_append);
           }
       });
   });
}
fetchUserActivity();
setInterval(function () {
   fetchUserActivity()
}, 15000);
</script>


Add anywhere you like


<!-- AJAX User Activity - 15sec interval -->
<div id="user-activity"></div>


[ATTACH type="full" alt="activity2.png"]5608[/ATTACH]

Change your refresh interval (seconds) according to bold text below. Don't set it below 10 seconds, less than 5 and you will be taxing your server performance. Update in header.php

}, [color=rgb(226, 80, 65)]15[/color]000);
</script>
"Rodney465, post: 68795, member: 20325":

where must this go i did everything except this


Are you using mysqli or mysql? Both modules will connect with this.
Try to nslookup those domains and confirm domain status. Does not sound like there resolving. Alternatively, they have changed API path (unlikely).
replace

$avatar = htmlspecialchars($user["avatar"]);


with

$avatar = htmlspecialchars($dlrow["avatar"]);


$user has no place here. This is otherwise available by calling users.owner column by $_GET ID.

Whenever you want to check row, it must always resolve to the variable/statement for mysql (ASSOC, ARRAY, OBJECT, etc) query result(s). In this case, it is [color=rgb(226, 80, 65)]$dlrow[/color] and it is in a loop, so we point to $dlrow and assign to the conditional row check.
Announce - BIGINT Errors — 2020-07-07 01:12:24 in v3 Support
I have fixed it, no more errors. Peer table looks better. I updated away from alias function join() to implode() and added whitespace between quotes.

SQL_Query_exec("UPDATE torrents SET " . implode(", ", $updateset) . " WHERE id=$torrentid") or err("Tracker error: Unable to update torrent");
Announce - BIGINT Errors — 2020-07-07 00:02:04 in v3 Support
"mostvotedplaya, post: 68790, member: 20335":

The issue is the number can become negative, it should only subtract if numbers are both positive.


Interesting. Thanks for input, do you know if this is a known bug? I can force handling in my.cnf but I really want to get at the query and CAST the value as UNSIGNED, however since we are dealing with negative int's (subtracting from column for example), I wonder if I can use it there. Of course, each code edit results in a full clean off of admincp and right back to sqlerror log page (or view table in my client).

I've been through this today from left to right, to understand this issue and resolve. I believe it is throwing tracker stats off for some users too, as they are complaining about the same specific scenario. I encourage to change ports on torrent client and wait for announce interval, but that is not a solution.

I return back to this issue because my sqlerror log is jammed with these errors from announce.php on a daily basis. I never saw this before the move to MariaDB.

SO on this topic
[URL unfurl="true"]https://stackoverflow.com/questions/5605085/bigint-unsigned-value-is-out-of-range[/url]

So at this point I really want to just strip all the update sets and just foreach all of it in a array, as already in design. This made sense initially.

Issue:


if (count($updateset))
   SQL_Query_exec("UPDATE torrents SET " . join(",", $updateset) . " WHERE id=$torrentid") or err("Tracker error: Unable to update torrent");


So my idea is crunching down [color=rgb(84, 172, 210)]join()[/color] on [color=rgb(251, 160, 38)]$updateset [/color][color=rgb(209, 213, 216)]and go from there. Thoughts?[/color]
Announce - BIGINT Errors — 2020-07-06 20:23:55 in v3 Support
Digging deeper, this appears to be compatibility issue past MySQL 5.6.x, I’m curious if anyone on later versions of mysql/mariadb have this issue?

The problem is negative values in the torrents.leechers, where it is not handling negative integers.
The solution is to CAST as SIGNED in the last query line in announce.php, which I might still do.

Alternatively, add to my.cnf under [mysqld]

sql_mode = "NO_ENGINE_SUBSTITUTION"
Something I'm working on but have had in effect for a while, will post off here as i get items automatically updating speeds without refresh - next up.

ajax_update_torrentspeed.php


<?
// AJAX Dynamic Torrent Speeds - BETA - May 26, 2020
// Retrieve peers > calc downloaded/uploaded = byte sum > convert bytes > retrieve user in peer swarm by userid
require_once 'dbConfig.php';

$torrentid = isset($_GET['id'])?intval($_GET['id']):0;

try {
   $conn = new PDO("mysql:host={$dbHost};dbname={$dbName};charset=utf8", $dbUsername, $dbPassword);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$stmt = $conn->prepare("SELECT (SUM(peers.downloaded)) / (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(peers.started)) AS totalspeed, users.avatar_thumb AS avatar, peers.seeder, users.username, users.id, peers.userid FROM peers LEFT JOIN users ON peers.userid = users.id WHERE peers.torrent = :torrentid AND peers.seeder = 'no' ORDER BY peers.started ASC");
$stmt->bindParam(":torrentid", $torrentid, PDO::PARAM_INT);
$stmt->execute();
$userData = array();
if ($stmt->rowCount() > 0) {
   $usersactive = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($usersactive as $row => $data) {
       $data['totalspeed'] = $row['totalspeed'];
       $data['avatar'] = $row['avatar'];
       $data['id'] = $row['id'];
       $data['username'] = $row['username'];
       array_push($userData, $usersactive);
   }
}
echo str_replace('-', '', json_encode($usersactive, JSON_UNESCAPED_SLASHES)); // Bugfix: Removed dash in torrent speeds - July 4, 2020
?>


functions.php find

   foreach ($cols as $col) {
       switch ($col) {
           case 'category':


Add after


// Get torrent speed - AJAX
           if ($CURUSER) {
           ?>
           <script>
           $(document).ready(function () {
           $.ajax({
           url: "ajax_update_torrentspeed.php?id=<? echo $id; ?>",
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               $.each(data, function (i, item) {
                   html_to_append +=
                   '<span style="text-transform:capitalize">' +
                   formatBytesTorrentSpeed(item.totalspeed) +
                   '</span><a href="/user/?id=' +
                   item.id + '"><img src="' + item.avatar + '" style="height:45px;width:45px;border-radius:50%;margin-left:5px;vertical-align:middle;position:relative;z-index:10005;border: 2px solid #FFF;" /></a>';
               });
         
               // Append torrent ID to tag for loop
               $("#torrentspeed-<? echo $id; ?>").html(html_to_append);
           }
             
               });
           });
           </script>
           <?
           // Get current peers for this torrent by Avatar - Restyled - New index item - July 4, 2020 - text-align works! float:right cuts off box
     
           if ($result2["external"] != "yes" && $result2["leechers"] >= 1){
                   $getpeer = SQL_Query_exec("SELECT seeder, torrent, started FROM peers WHERE seeder = 'no' AND torrent = $id ORDER BY started ASC");
                   $a = mysql_fetch_assoc($getpeer);
                   if (empty($row['torrent']))
                   $totalspeed =   "<div style='text-align:right;margin-top:-27px;position:relative;z-index:950000'>
                               <span id='torrentspeed-$id' style='box-shadow:inset 0 0 10px #D42128;color:#FFF;background:#ED2324;border-radius:4px;padding-left:7px;padding-right:6px;padding-top:4px;padding-bottom:3px'></span>
                           </div>";
           } else {
                   $totalspeed = ""; // no active peer for this torrent
           }
     
           } // end if $CURUSER

functions is old code as new one is different, but these changes pass over.

Problem I'm having is getting those speeds changing without refreshing, not sure if its a jQuery problem or a issue with asynch requests but I'm working on it. Once working I just make work on old torrenttable
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