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");