Seems to work well on my dev site from more than 1 month with hard testing, so here it is
How does it works :
Every time a torrent is completed, user have to seed $ hours in an interval of $ days he start the download
after $ days he take 1 H&R if seedtime is < $ hours
to delete H&R, he just need to complete $ hours
when user take $ H&R, he is warn for $ days and he need to del 1 H&r min to del warn
after $ days warned, he is banned
when user take $ H&R he is banned directly
Write Log, Modcomment and email to user with reason when ban
You need SQL, function.php and announce.php modifications from 1st post MVP's snatchlist [url="http://www.torrenttrader.pw/index.php?/topic/16962-snatchlist/"]http://www.torrentt...962-snatchlist/[/url]
SQL
ALTER TABLE `snatched` ADD `hnr` enum('no','yes') NOT NULL DEFAULT 'no';
config.php
add above ?>
change value with what you want
announce.php
find
change for
find
add underneath
find
change for
cleanup.php
find
change for
find
add above (english version)
or add above (french version)
account-details
find
add above
find
add above
find
add above
account.php
find
add underneath
delete your snatchlist.php or snatched.php and use the one attached
I use contact.php which is nothing to do with this H&R system so if you don't use it delete link in email part(cleanup.php)
I already use class_user() function so delete each in snatched.php if you don't use it
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6613"]snatched.php[/url]
How does it works :
Every time a torrent is completed, user have to seed $ hours in an interval of $ days he start the download
after $ days he take 1 H&R if seedtime is < $ hours
to delete H&R, he just need to complete $ hours
when user take $ H&R, he is warn for $ days and he need to del 1 H&r min to del warn
after $ days warned, he is banned
when user take $ H&R he is banned directly
Write Log, Modcomment and email to user with reason when ban
You need SQL, function.php and announce.php modifications from 1st post MVP's snatchlist [url="http://www.torrenttrader.pw/index.php?/topic/16962-snatchlist/"]http://www.torrentt...962-snatchlist/[/url]
SQL
ALTER TABLE `snatched` ADD `hnr` enum('no','yes') NOT NULL DEFAULT 'no';
config.php
add above ?>
//H&R config
$site_config["hnr_deadline"] = 7*86400; // 7 days remaining
$site_config["hnr_seedtime"] = 36*3600; // 36 hours to seed
$site_config["hnr_warn"] = 3; // how many h&r to warn
$site_config["hnr_ban"] = 5; // how many h&r to ban
$site_config["hnr_disabled"] = 7*86400; // days to ban warnedchange value with what you want
announce.php
find
if ( ($MEMBERSONLY) && (($seeder == 'no' && $torrent['freeleech'] == 0)) )change for
if ( $MEMBERSONLY && $seeder == 'no' )find
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $upthis WHERE id=$userid") or err("Tracker error: Unable to update stats");add underneath
SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `uload` = `uload` + '$upthis', `utime` = '".gmtime()."', `ltime` = `ltime` + '$elapsed' WHERE `tid` = '$torrentid' AND `uid` = '$userid'");find
$elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;change for
if ( $_GET[ 'event' ] != 'stopped' )
{
$elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;
}cleanup.php
find
//REMOVE WARNING
$res1 = SQL_Query_exec("SELECT users.id, users.username FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND warned = 'yes' AND enabled='yes' AND uploaded / downloaded >= $minratio AND downloaded >= $downloaded");change for
// REMOVE WARNINGS
$res1 = SQL_Query_exec("SELECT users.id, users.username, warnings.expiry FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type != 'Poor Ratio' AND type != 'HnR' AND warned = 'yes' AND enabled='yes' AND warnings.active = 'yes' AND warnings.expiry < '".get_date_time()."'");find
//OPTIMIZE TABLESadd above (english version)
//===| HIT & RUN
$timenow = gmtime();
SQL_Query_exec("UPDATE snatched SET hnr = 'yes' WHERE completed = '1' AND hnr = 'no' AND uload < dload AND $timenow - $site_config[hnr_deadline] > stime AND $site_config[hnr_seedtime] > ltime");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND uload >= dload");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND ltime >= $site_config[hnr_seedtime]");
$a = SQL_Query_exec("SELECT DISTINCT uid FROM snatched WHERE hnr = 'yes'");
if ( mysql_num_rows($a) > 0 ) :
while ($b = mysql_fetch_row($a)) :
$c = SQL_Query_exec("SELECT COUNT( hnr ) FROM snatched WHERE uid = $b[0] AND hnr = 'yes'");
$d = mysql_fetch_row($c);
$count = $d[0];
$user = $b[0];
$length = $site_config["hnr_disabled"];
$expiretime = gmdate("d-M-Y H:i:s", $timenow + $length);
$e = SQL_Query_exec("SELECT type, active FROM warnings WHERE userid = '$user'");
$f = mysql_fetch_row($e);
$type = $f[0];
$active = $f[1];
# warn user
if ( $count >= $site_config["hnr_warn"] && $type != "HnR" ) :
$reason = "You're warned because you have accumulated ".$site_config['hnr_warn']." HnR";
$subject = "Warning for H&R";
$msg = "You're warned because you have accumulated ".$site_config['hnr_warn']." H&RnYou must to keep seeding for the torrents that you have downloaded.nAttention! If you do not remove at least 1 Hit & Run within 7 days, your account will be banned.nIt will be the same if you continue to accumulate Hits & Run.";
$rev = SQL_Query_exec("SELECT enabled FROM users WHERE id = $user");
$rov = mysql_fetch_assoc($rev);
if ($rov["enabled"] == "yes") :
SQL_Query_exec("UPDATE users SET warned = 'yes' WHERE id = $user");
SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES ($user,'".$reason."','".get_date_time()."','".$expiretime."','0','HnR')");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 0)");
endif;
endif;
# remove warning
if ( $count < $site_config["hnr_warn"] && $type == "HnR") :
$subject = "Your warning for H&R has been removed.";
$msg = "You have now less than ".$site_config['hnr_warn']." H&R.nYour warning for H&R has been removed.";
SQL_Query_exec("UPDATE users SET warned = 'no' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 0)");
endif;
# ban user
if ( $count >= $site_config["hnr_ban"] ) :
$g = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $user");
$h = mysql_fetch_row($g);
$modcomment = $h[2];
$modcomment = gmdate("d-M-Y") . " - Has been disabled because he accumulated: " .$count. " H&Rn " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
write_log("<a href='account-details.php?id=".$user."'><b>".$h[0]."</b></a> has been disabled because he accumulated <b>".$count."</b> H&R");
# send email
$subject = "Your account at $site_config[SITENAME] has been disabled";
$body = "You have been banned for the following reason:n
------------------------------
nYou have accumulated $count H&Rn
------------------------------
nYou can contact us by following this link:
".$site_config['SITEURL']."/contact.php
nnn".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($h[1], "$subject", "$body", "From $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endif;
endwhile;
endif;
//Ban warned user
$timenow = gmtime();
$k = SQL_Query_exec("SELECT userid FROM warnings WHERE type = 'HnR' AND active = 'yes' AND UNIX_TIMESTAMP(expiry) < $timenow");
if ( mysql_num_rows($k) > 0 ) :
while ($l = mysql_fetch_row($k)) :
$m = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $l[0] AND enabled = 'yes' AND warned = 'yes'");
$n = mysql_fetch_row($m);
$modcomment = $n[2];
$modcomment = gmdate("d/m/Y") . " - Banned because that the warning time for H&R has expired.n " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $l[0]");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $l[0] AND type = 'HnR'");
write_log("<a href='account-details.php?id=".$l[0]."'><b>".$n[0]."</b></a> has been banned because that the warning time for H&R has expired.");
$subject = "Your account at $site_config[SITENAME] has been disabled";
$body = "You have been banned for the following reason:n
------------------------------
nThe warning time for H&R has expired.n
------------------------------
nYou can contact us by following this link:
".$site_config['SITEURL']."/contact.php
nnn".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($n[1], "$subject", "$body", "From $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endwhile;
endif;
//===| END HIT & RUNor add above (french version)
//HIT & RUN
$timenow = gmtime();
SQL_Query_exec("UPDATE snatched SET hnr = 'yes' WHERE completed = '1' AND hnr = 'no' AND uload < dload AND $timenow - $site_config[hnr_deadline] > stime AND $site_config[hnr_seedtime] > ltime");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND uload >= dload");
SQL_Query_exec("UPDATE `snatched` SET `hnr` = 'no' WHERE `hnr` = 'yes' AND ltime >= $site_config[hnr_seedtime]");
$a = SQL_Query_exec("SELECT DISTINCT uid FROM snatched WHERE hnr = 'yes'");
if ( mysql_num_rows($a) > 0 ) :
while ($b = mysql_fetch_row($a)) :
$c = SQL_Query_exec("SELECT COUNT( hnr ) FROM snatched WHERE uid = $b[0] AND hnr = 'yes'");
$d = mysql_fetch_row($c);
$count = $d[0];
$user = $b[0];
$length = $site_config["hnr_disabled"];
$expiretime = gmdate("Y-m-d H:i:s", $timenow + $length);
$e = SQL_Query_exec("SELECT type, active FROM warnings WHERE userid = '$user'");
$f = mysql_fetch_row($e);
$type = $f[0];
$active = $f[1];
//warn
if ( $count >= $site_config["hnr_warn"] && $type != "HnR" ) :
$reason = "Avertissement pour avoir accumulé ".$site_config['hnr_warn']." HnR.";
$subject = "Avertissement pour H&R";
$msg = "Vous avez été averti car vous avez accumulé ".$site_config['hnr_warn']." H&R.nNous vous invitons à consulter les règles sur le téléchargement.nAttention! Si vous n'effacez pas au moins 1 Hit & Run sous 7 jours, votre compte sera banni.nIl en sera de même si vous continuez à accumuler les Hits & Run.";
$rev = SQL_Query_exec("SELECT enabled FROM users WHERE id = $user");
$rov = mysql_fetch_assoc($rev);
if ($rov["enabled"] == "yes") :
SQL_Query_exec("UPDATE users SET warned = 'yes' WHERE id = $user");
SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES ($user,'".$reason."','".get_date_time()."','".$expiretime."','0','HnR')");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 0)");
endif;
endif;
//Unwarned
if ( $count < $site_config["hnr_warn"] && $type == "HnR") :
$subject = "Retrait d'avertissement HnR.";
$msg = "Vous avez désormais moins de ".$site_config['hnr_warn']." H&R.nVotre avertissement pour H&R a été retiré.";
SQL_Query_exec("UPDATE users SET warned = 'no' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES (0, $user, '".get_date_time()."', ".sqlesc($subject).", ".sqlesc($msg).", 0)");
endif;
//Ban
if ( $count >= $site_config["hnr_ban"] ) :
$g = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $user");
$h = mysql_fetch_row($g);
$modcomment = $h[2];
$modcomment = gmdate("d/m/Y") . " - Banni pour " .$count. " H&R.n " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $user");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $user AND type = 'HnR'");
write_log("Le membre <a href='account-details.php?id=".$user."'>".$h[0]."</a> a été banni. Raison : ".$count." H&R.");
$subject = "Votre compte sur $site_config[SITENAME] a été désactivé";
$body = "Vous avez été banni pour la raison suivante :n
------------------------------
nVous avez accumulé $count H&R.n
------------------------------
nVous pouvez nous contacter en suivant ce lien :
".$site_config['SITEURL']."/contact.php
nnn".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($h[1], "$subject", "$body", "De: $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endif;
endwhile;
endif;
//Ban warned
$timenow = gmtime();
$k = SQL_Query_exec("SELECT userid FROM warnings WHERE type = 'HnR' AND active = 'yes' AND UNIX_TIMESTAMP(expiry) < $timenow");
if ( mysql_num_rows($k) > 0 ) :
while ($l = mysql_fetch_row($k)) :
$m = SQL_Query_exec("SELECT username, email, modcomment FROM users WHERE id = $l[0] AND enabled = 'yes' AND warned = 'yes'");
$n = mysql_fetch_row($m);
$modcomment = $n[2];
$modcomment = gmdate("d/m/Y") . " - Banni pour délai d'avertissement H&R expiré.n " .$modcomment;
SQL_Query_exec("UPDATE users SET enabled = 'no', warned = 'no', modcomment = '$modcomment' WHERE id = $l[0]");
SQL_Query_exec("DELETE FROM warnings WHERE userid = $l[0] AND type = 'HnR'");
write_log("Le membre <a href='account-details.php?id=".$l[0]."'>".$n[0]."</a> a été banni. Raison : Délai d'avertissement H&R expiré.");
$subject = "Votre compte sur $site_config[SITENAME] a été désactivé";
$body = "Vous avez été banni pour la raison suivante :n
------------------------------
nDélai avertissement H&R expiré.n
------------------------------
nVous pouvez nous contacter en suivant ce lien :
".$site_config['SITEURL']."/contact.php
nnn".$site_config['SITENAME']." ".T_("ADMIN");
sendmail($n[1], "$subject", "$body", "De: $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
endwhile;
endif;
//END HIT & RUNaccount-details
find
$numtorrents = get_row_count("torrents", "WHERE owner = $id");add above
//h&r
$qry = SQL_Query_exec("SELECT COUNT(`hnr`) FROM `snatched` WHERE `uid` = '$id' AND `hnr` = 'yes'");
$res = mysql_fetch_row($qry);
$hnr = $res[0];find
<?php echo T_("AVG_DAILY_DL"); ?>: <?php echo mksize($user["downloaded"] / (DateDiff($user["added"], time()) / 86400)); ?><br />add above
<b>Hit & Run :</b> <?php echo $hnr; ?><br />find
<?php
}
//teamadd above
<tr><td><a href="snatched.php?uid=<?php echo $user["id"]?>"><b>Snatchs List</b></a></td></tr>account.php
find
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>add underneath
|
<?php print("<a href='snatched.php'><b>".T_("SNATCHLIST")."</b></a>");?>delete your snatchlist.php or snatched.php and use the one attached
I use contact.php which is nothing to do with this H&R system so if you don't use it delete link in email part(cleanup.php)
I already use class_user() function so delete each in snatched.php if you don't use it
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6613"]snatched.php[/url]