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
Seed Bonus [TTv3]
Controls ·  Search New posts · Mark unread

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

2020-03-03 13:02:47
Thanks for the help there was nothing wrong i was to eager to see it working :D with a force clean it showed up (lol took a while for it to finish 490 members on the site) and after the scheduled cleanup it updated again.
Torrent Trader PDO/MVC 2021
Xampp Windows 10 21H1
Apache Version: Apache/2.4.48 (Win64)
Mysql Version: 10.4.20-MariaDB
PHP Version: 8.0.9
2020-03-19 13:42:47
Hi i just want to ask if i need to change something on my settings or my database because when the cleanup process is running it takes almost 10min to complete but without this mod it completes almost instantly.
Torrent Trader PDO/MVC 2021
Xampp Windows 10 21H1
Apache Version: Apache/2.4.48 (Win64)
Mysql Version: 10.4.20-MariaDB
PHP Version: 8.0.9
2020-05-20 07:00:50
Nice, thanks for this!, I'm going to convert it over, few issues admincp bottom has mismatched ids for both SELECT and UPDATE statements, not too sure, request[id] and $id are both stated.
2020-05-20 09:07:13
Few changes, if anyone wants to pick apart. It not only disables if low on seed bonus, but also prints "not enough" in place of button text. Until I change all PHP code to PDO and retain HTML. I could use objects again or go the other way. Either way works, the original mod dev had procedural in mind.


<? while ($row = mysql_fetch_object($res)): ?>

<article itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Article" class="card">

   <form method="post" class="cd-form floating-labels" action="/seedbonus/">
       <input type="hidden" name="id" value="<? echo $row->id; ?>" />
           <div class="card-action ng-scope" style="font-size:22px">
   
               <!-- Seeder exchange -->
               <span style="font-size:27px;font-weight:400;padding: 7px 5px 5px 10px;border-radius:7px;background:#C0C0C0;text-align:center;color:#FFF;box-shadow: inset 1px 5px 7px -6px #000000;margin-right:15px">
                   <? echo str_replace('Uploaded', ' ', htmlspecialchars($row->title)); ?>
               </span>
               <? echo htmlspecialchars($row->descr); ?>
               <? echo htmlspecialchars($row->cost); ?>
               <span style="float:right;margin-right:-125px">
                   <button class="btn btn-danger" onclick="this.form.submit();" style="font-size:15px" <? echo ($CURUSER['seedbonus'] < $row->cost ? 'disabled' : null); ?>>
                       <? if ($CURUSER['seedbonus'] < $row->cost){ echo "Not Enough"; } else { echo "Exchange"; } ?>
                   </button>
               </span>
   
             </div>
   </form>

</article>

<? endwhile; ?>


[ATTACH type="full" alt="NewSeedBonusFeature.png"]5539[/ATTACH]
NewSeedBonusFeature.png
NewSeedBonusFeature.png
2020-05-20 17:37:29
Also reports in database error, disabling signup and uploading if not caught

Field 'seedbonus' doesn't have a default value

SQL Fix:


ALTER TABLE users;
ALTER seedbonus SET DEFAULT 0.0;
2020-05-20 18:45:08
"spiritblue, post: 66899, member: 401":

small complement ...

5 seedbonus points for commenting on a torrent.
[color=rgb(41, 105, 176)](it's up to you to change the number 5 to Luis himself) [/color]

Search in [color=rgb(251, 160, 38)]torrents-details.php[/color] :
SQL_Query_exec("UPDATE torrents SET comments = comments + 1 WHERE id = $id");


Add after :

// Points Seedbonus By spiritblue
$commentaire = get_row_count("comments", "WHERE torrent = $id AND user = $CURUSER[id]");    
if ($commentaire < 1) {
   SQL_Query_exec("UPDATE users SET seedbonus = seedbonus+5.0 WHERE id = ".$CURUSER["id"]."") ;
}
// End Points Seedbonus


Note: this line could also be used on another page, change the variable (y)


Works great! Thanks so much.

I think a second column needs to be in place, to allow checking and replacing points bonus for comment deleted. A user can go on a comment frenzy, and post 100 across the site, maybe even spam links. In turn, they boost their seed bonus and leech off the tracker. Just logic error. A lot of services ignore that, but if anyone wants a tighter situation.. this is a serious flaw. I'll see what I can do
2020-05-24 09:16:13
noticed a error with this mod when updating

in config we use

$site_config['autoclean_interval'] = 600; // time to cleanup (10 minutes)


we need new config time

$site_config['add_bonus'] = 3600; // time to add bonus (1 hour)


so bonus is not correct its more like this
You recieve X points per 10 minutes the system registers you as a seeder by torrent.

so in mybonus change

floor($site_config['autoclean_interval'] / 10),


to [color=rgb(250, 197, 28)]should be 60 for seconds[/color]


floor($site_config['add_bonus'] / 60),


then we put new condition on cleanup - the auto cleanup 10 minutes the seedbonus 1 hour

// Seedbonus Mod
   $now = gmtime();
   $dobonus = 0;

   $res = SQL_Query_exec("SELECT last_time FROM tasks WHERE task='bonus'");
   while ( $row = mysqli_fetch_object($res) )

   if (!$row) {
       SQL_Query_exec("INSERT INTO tasks (task, last_time) VALUES ('bonus',$now)");
       // write_log("theres was no row silly we need one to start");
   }

   $ts = $row['last_time']; // $row['0'] returned null

   if ($ts + $site_config['add_bonus'] < $now){

   $qry = "SELECT DISTINCT userid as peer, (
   SELECT DISTINCT COUNT( torrent )
   FROM peers
   WHERE seeder = 'yes'  AND userid = peer) AS count
   FROM peers WHERE seeder = 'yes'";

   $res1 = SQL_Query_exec($qry);
   while ( $row = mysqli_fetch_object($res) )
   {
       SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
       SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='bonus'");
       // write_log("bonus and task inserted every hour");
   }
   }
   // End


use the writelog function to log cleanups to makes sure its correct
// write_log("bonus and task inserted every hour");
2020-05-24 09:59:23
"m-jay, post: 68645, member: 20288":

noticed a error with this mod when updating

in config we use

$site_config['autoclean_interval'] = 600; // time to cleanup (10 minutes)


we need new config time

$site_config['add_bonus'] = 3600; // time to add bonus (1 hour)


so bonus is not correct its more like this
You recieve X points per 10 minutes the system registers you as a seeder by torrent.

so in mybonus change

floor($site_config['autoclean_interval'] / 10),


to [color=rgb(250, 197, 28)]should be 60 for seconds[/color]


floor($site_config['add_bonus'] / 60),


then we put new condition on cleanup - the auto cleanup 10 minutes the seedbonus 1 hour

// Seedbonus Mod
   $now = gmtime();
   $dobonus = 0;

   $res = SQL_Query_exec("SELECT last_time FROM tasks WHERE task='bonus'");
   while ( $row = mysqli_fetch_object($res) )

   if (!$row) {
       SQL_Query_exec("INSERT INTO tasks (task, last_time) VALUES ('bonus',$now)");
       // write_log("theres was no row silly we need one to start");
   }

   $ts = $row['last_time']; // $row['0'] returned null

   if ($ts + $site_config['add_bonus'] < $now){

   $qry = "SELECT DISTINCT userid as peer, (
   SELECT DISTINCT COUNT( torrent )
   FROM peers
   WHERE seeder = 'yes'  AND userid = peer) AS count
   FROM peers WHERE seeder = 'yes'";

   $res1 = SQL_Query_exec($qry);
   while ( $row = mysqli_fetch_object($res) )
   {
       SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
       SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='bonus'");
       // write_log("bonus and task inserted every hour");
   }
   }
   // End


use the writelog function to log cleanups to makes sure its correct
// write_log("bonus and task inserted every hour");


Thanks!! I will try this
2020-05-24 13:54:46
Damn, I never noticed that. Will give it a go. Thanks
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)
2020-05-24 14:29:02
happy to share, surprised i never noticed too lol not been able to test on v3 so this may cause issue
$ts = $row['last_time']; // $row['0'] returned null i use objects though

maybe worth var_dump() to make sure its a int string
2020-08-22 10:28:00
simplest solution in backend/cleanup.php if your cleanup runs every 10 minutes (600 seconds). I revisited this because your solution didnt work for me, and im lazy, so I just did this. I touched the keyboard a very minimal amount of times haha
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . (($site_config["bonuspertime"] / 6) * $row->count) . "' WHERE id = '" . $row->peer . "' AND seedbonus < ".$site_config["bonusmax"]."");

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)
2020-08-22 20:19:09
"MicroMonkey, post: 69148, member: 311":

simplest solution in backend/cleanup.php if your cleanup runs every 10 minutes (600 seconds). I revisited this because your solution didnt work for me, and im lazy, so I just did this. I touched the keyboard a very minimal amount of times haha
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . (($site_config["bonuspertime"] / 6) * $row->count) . "' WHERE id = '" . $row->peer . "' AND seedbonus < ".$site_config["bonusmax"]."");



MySQLi. * for PDO, this is prepared and mostly different.
2020-09-28 10:38:35
"spiritblue, post: 67259, member: 401":

Some additions to this mod:

~
// Time between each auto cleanup (Seconds).
~ // Set the maximum possible value of your seed bonus.
~ // On or Off ? - true / false.

Search [color=rgb(251, 160, 38)]backend / [/color][color=rgb(243, 121, 52)]config.php[/color] :

//SEEDBONUS
$site_config["bonuspertime"] = 0.5;


Replace with :

// Seed Bonus
$site_config["bonuspertime"] = 0.5; // Set this to what ever you want to give people per torrent.
$site_config['autoclean_interval'] = '3600'; // Time between each auto cleanup (Seconds).
$site_config["bonusmax"] = 3000; // Set the maximum possible value of your seed bonus.
$site_config['SEEDBONUS'] = false; // On or Off ? - true / false.


In [color=rgb(251, 160, 38)]backend /[/color] [color=rgb(243, 121, 52)]cleanup.php[/color] search :

// Seedbonus
$qry = "SELECT DISTINCT userid as peer, (
SELECT DISTINCT COUNT( torrent )
FROM peers
WHERE seeder = 'yes'  AND userid = peer) AS count
FROM peers WHERE seeder = 'yes'";

$res = SQL_Query_exec($qry);
while ( $row = mysqli_fetch_object($res) )
{
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "'");
}
// End


Replace with :

// Seedbonus upadate 2019 by spiritblue
if ($CURUSER["SEEDBONUS"]) {
$qry = "SELECT DISTINCT userid as peer, (
SELECT DISTINCT COUNT( torrent )
FROM peers
WHERE seeder = 'yes'  AND userid = peer) AS count
FROM peers WHERE seeder = 'yes'";

$res = SQL_Query_exec($qry);
while ( $row = mysqli_fetch_object($res) )
{
SQL_Query_exec("UPDATE users SET seedbonus = seedbonus + '" . ($site_config["bonuspertime"] * $row->count) . "' WHERE id = '" . $row->peer . "' AND seedbonus < ".$site_config["bonusmax"]."");
}
}
// End Seedbonus








Merci il fonctionne bien et j'ai fixer la limite a 25000 point de seedbonus et il y a déjà des comptes existant avec plus de  25000 points et pouvez vous me dire si il y a un moyen de remettre les comptes users qui on plus de 25000 points de seed bonus  à jour avec 25 000 points ??

Peut-être y ajouter un bout de code  SQL UPDATE USER SEEDBONUS ou  ?? je sais pas ???
2020-09-29 03:47:10
"niki, post: 69416, member: 20338":

Merci il fonctionne bien et j'ai fixer la limite a 25000 point de seedbonus et il y a déjà des comptes existant avec plus de  25000 points et pouvez vous me dire si il y a un moyen de remettre les comptes users qui on plus de 25000 points de seed bonus  à jour avec 25 000 points ??

Peut-être y ajouter un bout de code  SQL UPDATE USER SEEDBONUS ou  ?? je sais pas ???


Je ne recommanderais pas la réinitialisation, car cela nuirait aux efforts légitimes. prendre plaisir. laissez le système prendre ses cycles comme le système le verra.
2020-09-29 04:17:04
ok merci de votre réponse (y)
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