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

You are in: Forum / Forum / Torrent Trader / v3 Support

2023-09-14 07:52:37
Bonjour, la fonction seed bonus est installé depuis un moment et les membres me disent que la mise à jour de leur compte en seedbonus est incorrecte quand il on plusieurs torrent en seed la fonction du seed bonus ne fonctionne pas correctement car il ne reçoivent pas la totalité de leur point par heure et qu'il faut plusieurs heures pour que la mise à jour s'effectue et ma configuration est de 2 points par heure ??

Hello, the seed bonus function has been installed for a while and members tell me that updating their seedbonus account is incorrect when they have several seed torrents the seed bonus function does not work correctly because they do not receive the their entire point per hour and it takes several hours for the update to take place and my configuration is 2 points per hour ??



voici ma configuration ci-dessous et je joint le fichier mybonus.php

here is my configuration below and I attach the mybonus.php file



config.php

// Seed Bonus
$site_config["bonuspertime"] = 2.0; // Set this to what ever you want to give people per torrent.
$site_config['autoclean_interval'] = '3600'; // Temps entre chaque nettoyage automatique (secondes).
$site_config["bonusmax"] = 50000; // Definissez la valeur maximale possible de votre bonus de démarrage.
$site_config['SEEDBONUS'] = true; // On or Off ? - true / false.




cleanup.php

// Seedbonus upadate 2019 by spiritblue / if() statemement edited by MicroMonkey and beer
if ($site_config["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




account.php

<?php print("<a href='mybonus.php'><b>Mon Seed bonus</b></a>");?>




admincp.php

#======================================================================#
# Seedbonus Manager
#======================================================================#
if ($action == "seedbonus" && $do != "change")
{

  if (get_user_class() < 3)
     show_error_msg("STOP", "Area reserved for people entitled! and you do not have permission !!!");
   if ($do == "del")
   {
       if (!@count($_POST["ids"])) show_error_msg("Error", "select nothing.", 1);
       $ids = array_map("intval", $_POST["ids"]);
       $ids = implode(", ", $ids);
       
       SQL_Query_exec("DELETE FROM `bonus` WHERE `id` IN ($ids)");
       autolink("admincp.php?action=seedbonus", "deleted entries");
   }

   $count = get_row_count("bonus");

   list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=seedbonus&');
                                                                                                                                                                                                                                                               
   $res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` ORDER BY `type` $limit");

   stdhead("Seedbonus Manager");
   navmenu();
                                                       
   begin_frame("Management of Seed Bonus");
   ?>

   <center>
This page displays all available options trade which users can exchange for seedbonus.<?php echo number_format($count); ?> ; <br><br><a href="admincp.php?action=seedbonus&do=change&id=null">Add</a> a new option?
   </center>

   <?php if ($count > 0): ?>
   <br />
   <form id="seedbonus" method="post" action="admincp.php?action=seedbonus">
   <input type="hidden" name="do" value="del" />
   <table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
   <tr>
       <th class="table_head">Title</th>
       <th class="table_head">Description</th>
       <th class="table_head">Points</th>
       <th class="table_head">Valeur</th>
       <th class="table_head">Type</th>
       <th class="table_head">Edit</th>
       <th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
   </tr>

   <?php while ($row = mysqli_fetch_object($res)):
 $row->value = ( $row->type == "traffic" ) ? mksize( $row->value ) : ( int ) $row->value;
 ?>
   <tr>
   <td class="table_col1" align="center"><?php echo htmlspecialchars($row->title); ?></td>
   <td class="table_col2"><?php echo htmlspecialchars($row->descr); ?></td>
   <td class="table_col1" align="center"><?php echo $row->cost; ?></td>
   <td class="table_col2" align="center"><?php echo $row->value; ?></td>
   <td class="table_col1" align="center"><?php echo $row->type; ?></td>
   <td class="table_col2" align="center"><a href="admincp.php?action=seedbonus&do=change&id=<?php echo $row->id; ?>">Edit</a></td>
   <td class="table_col1" align="center"><input type="checkbox" name="ids[]" value="<?php echo $row->id; ?>" /></td>
   </tr>
   <?php endwhile; ?>

   <tr>
       <td colspan="7" align="right">
       <input type="submit" value="Remove Selected" />
       </td>
   </tr>
   </table>            
   </form>
   <?php
   endif;

   if ($count > 25) echo $pagerbottom;

   end_frame();
   stdfoot();
}
       
if ($action == "seedbonus" && $do == "change")
{
   $row = null;
   if ( is_valid_id($_REQUEST['id']) )
   {
       $res = SQL_Query_exec("SELECT id, title, cost, value, descr, type FROM `bonus` WHERE `id` = '$_REQUEST[id]'");
       $row = mysqli_fetch_object($res);
   }

   if ( $_SERVER['REQUEST_METHOD'] == 'POST' )
   {
       if ( empty($_POST['title']) or empty($_POST['descr']) or empty($_POST['type']) or !is_numeric($_POST['cost']) )
       {
               autolink($_SERVER['HTTP_REFERER'], "missing information.");
       }


$_POST["value"] = ( $_POST["type"] == "traffic" ) ? strtobytes( $_POST["value"] ) : ( int ) $_POST["value"];
       $var = array_map('sqlesc', $_POST);
       extract( $var );

       if ( $row == null )
       {
               SQL_Query_exec("INSERT INTO `bonus` (`title`, `descr`, `cost`, `value`, `type`) VALUES ($title, $descr, $cost, $value, $type)");
       }
       else
       {
               SQL_Query_exec("UPDATE `bonus` SET `title` = $title, `descr` = $descr, `cost` = $cost, `value` = $value, `type` = $type WHERE `id` = $id");
       }
                       
       autolink("admincp.php?action=seedbonus", "Updating the bonus seed.");
   }
       
   stdhead("Seedbonus Management");
   navmenu();

   begin_frame("Seedbonus Management");
   ?>

   <form method="post" action="admincp.php?action=seedbonus&do=change">

   <?php if ($row != null): ?>
   <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
   <?php endif; ?>

   <table border="0" class="table_table" width="90%" cellpadding="3" align="center">
   <tr>
       <th class="table_head" colspan="2">Seedbonus Management</th>
   </tr>
   <tr>
       <td class="table_col1"><b>Title:</b></td>
       <td class="table_col2"><input type="text" name="title" value="<?php echo ( $row != null ? $row->title : null ); ?>" size="50" /></td>
   </tr>
   <tr>
       <td class="table_col1"><b>Points:</b></td>
       <td class="table_col2"><input type="text" name="cost" value="<?php echo ( $row != null ? $row->cost : null ); ?>" size="5" /></td>
   </tr>
   <tr>
       <td class="table_col1"><b>Type:</b></td>
       <td class="table_col2">
       <select name="type">
       <?php foreach (array('invite', 'traffic','VIP', 'other') as $type): ?>
       <option value="<?php echo $type; ?>" <?php echo ( $row != null && $row->type == $type ? 'selected="selected"' : null ); ?>><?php echo $type; ?></option>
       <?php endforeach; ?>
       </select>
       </td>
   </tr>
   <tr>
       <td class="table_col1"><b>Value:</b></td>
       <td class="table_col2"><input type="text" name="value" value="<?php echo ( $row != null ? $row->value : null ); ?>" size="10" /></td>
   </tr>
   <tr>
       <td class="table_col1" valign="top"><b>Description:</b></td>
       <td class="table_col2"><textarea name="descr" rows="5" cols="38"><?php echo ( $row != null ? $row->descr : null ); ?></textarea></td>
   </tr>
   <tr>
       <td colspan="2" align="right">
       <input type="reset" value="Cancel" />
       <input type="submit" value="To send" />
       </td>
   </tr>
   </table>
   </form>

   <?php
   end_frame();
   stdfoot();
}





mybonus.zip
Download
2023-09-14 16:19:54
I was using this for over 2 years, and also same complaints. I have replaced it with a new system, that also counts seeding 'time' not just 'count' and coded the entire thing from scratch, importing the bonus code into a primary endpoint - its completely AJAX-driven.

https://i.imgur.com/Jy127Vx.jpg

Sometimes you just have to pull out pen and paper, sketch out what you want.. and start typing it out into reality.

Hung onto the old TTv3 "Seed Bonus" page as long as possible, and it served for years but people want more - and the store was born.

---

Anyone interested in the new calculation function, PM me and I will send it over with instructions.

Last edited by STorrents2020 on 2023-09-14 16:23:21
2023-09-14 16:41:04
Merci beaucoup de votre réponse STorrents2020 et comment on fait pour installer cette nouvelle version ??

Thank you very much for your response STorrents2020 and how do we install this new version??
2023-09-14 21:18:18
I'll put together a ZIP but some SQL will have to be edited for user / torrent. the rest of it reads the old 'bonus' table and the defaults as normal.

The seedbox calc function -


private function CalcSeedBonus(int $torrentId, string $lastAnnounce, int $completed): float
{
$currentTime = time();
$lastAnnounceTime = strtotime($lastAnnounce);
$timeDifference = $currentTime - $lastAnnounceTime;

if ($completed == 1) {
$seedBonus = $this->baseSeedBonus + ($timeDifference * $this->timeMultiplier);
} else {
$seedBonus = 0;
}

return $seedBonus;
}
Last edited by STorrents2020 on 2023-09-14 21:26:04
2023-09-15 04:21:43
Thanks I will wait for your zip and instructions for this new seedbonus hack.  😬
2023-09-15 05:28:33
Me2, thanks


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-09-15 14:23:04
And I hope we solve this problem with the seed time as shown in the picture (torrents are downloaded the same day and the seed is kept the same but the calculated time for the seed is different, not seedbox but regular uTorrent)




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
Last edited by Botanicar on 2023-09-15 14:23:35
2023-09-15 16:16:57
Its never been perfect. The original mod, just sent bytes to 'uploaded' as to prevent cleanup from banning people. Im still deciding on this, as I have enough events stimulating upload credit.

All the original mod did was count # of torrents seeding (peer table). What it did not do was use max() to avoid negative overflows. Also, it did not consider 'seeding time' on top of seeding count.

I use a calculation for this now.
Last edited by STorrents2020 on 2023-09-16 16:25:43
2023-09-16 16:44:26
This is my final beta - its working very well. Quite interactive, all stats update automatically every 10 seconds, seeders history every 15 seconds (or on transaction complete). 3 days of javascript, PHP and SQL testing

https://i.imgur.com/PpA6MGt.jpg
2023-09-28 20:05:16
I tried to implement 4 mods to torrenttable() (backend/functions.php) and the code is just so aged so I had to discontinue. The code efficiency is just so low that it would introduce addition errors and problems before seeing the mods actually working.

I think any work I do forward, must go through my strict short-hand style of coding. My own codebase follows this, while I dont line up to true PSR spec, I do lean beside a close definition strict=1, but not quite yet.

This makes modifying TTv3 difficult when I ported out. While some things are the same internally, most of rewritten.

The mods to be added:
- Torrent Table: Seeders Speed Score (icon, 4 colors in total - admincp configurable)
- Live torrent stats w/ interval refresh - admincp configurable
- Move seeders/leechers stats reading to read peers table (live)
- Torrent signing - torrents-upload.php - admincp configurable (w/ cert creation)

First is first - remove this bencode library and manual dictionaries, and parse torrent data using a better library, etc
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