Hello, I'm looking for the code to add in the cleanup.php file to disable downloading only for members with a ratio lower than 0.20 and with a mp message to indicate that downloading on their account is disabled.
thank you in advance for your help 😊
I started to modify the original warning code of torrent trader and I modified in the file cleanup.php in the code this,...
warning with downloadbanned
and the downloadbanned box in account-detail.php is ticked and the member with a ratio under 0.20 can no longer download but the problem is that when the member has increased his ratio and has a ratio higher than 0.20 the downloadbanned box remains ticked and the member still can't download
the warning code I've modified in the conf.php file below;
the warning code I've modified in the cleanup.php file below;
thank you in advance for your help 😊
I started to modify the original warning code of torrent trader and I modified in the file cleanup.php in the code this,...
warning with downloadbanned
and the downloadbanned box in account-detail.php is ticked and the member with a ratio under 0.20 can no longer download but the problem is that when the member has increased his ratio and has a ratio higher than 0.20 the downloadbanned box remains ticked and the member still can't download
the warning code I've modified in the conf.php file below;
//AUTO RATIO WARNING
$site_config["ratiowarn_enable"] = true; //Enable/Disable auto ratio warning
$site_config["ratiowarn_minratio"] = 0.2; //Min Ratio
$site_config["ratiowarn_mingigs"] = 50; //Min GB Downloaded
$site_config["ratiowarn_daystowarn"] = 0; //Days to ban
the warning code I've modified in the cleanup.php file below;
//LEECHWARN USERS WITH LOW RATIO
if ($site_config["ratiowarn_enable"]){
$minratio = $site_config["ratiowarn_minratio"];
$downloaded = $site_config["ratiowarn_mingigs"]*1024*1024*1024;
$length = $site_config["ratiowarn_daystowarn"];
//ADD WARNING
$res = SQL_Query_exec("SELECT id,username FROM users WHERE class = 1 AND downloadbanned = 'no' AND enabled='yes' AND uploaded / downloaded < $minratio AND downloaded >= $downloaded");
if (mysqli_num_rows($res) > 0){
$timenow = get_date_time();
$reason = "Warning!!! You must obtain a sharing ratio of ".$minratio." minimum avant les ".$length." or you'll be banned from the download.";
$expiretime = gmdate("Y-m-d H:i:s", gmtime() + (86400 * $length));
while ($arr = mysqli_fetch_assoc($res)){
SQL_Query_exec("INSERT INTO warnings (userid, reason, added, expiry, warnedby, type) VALUES ('".$arr["id"]."','".$reason."','".$timenow."','".$expiretime."','0','Poor Ratio')");
SQL_Query_exec("UPDATE users SET downloadbanned='yes' WHERE id='".$arr["id"]."'");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES ('0', '".$arr["id"]."', '".$timenow."', '".$reason."', '0')");
write_log("Auto Leech warning has been <b>added</b> for: <a href='account-details.php?id=".$arr["id"]."'>".$arr["username"]."</a>");
}
}
//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");
if (mysqli_num_rows($res1) > 0){
$timenow = get_date_time();
$reason = "Bravo the download is now active.\n";
while ($arr1 = mysqli_fetch_assoc($res1)){
write_log("Auto Leech warning has been removed for: <a href='account-details.php?id=".$arr1["id"]."'>".$arr1["username"]."</a>");
SQL_Query_exec("UPDATE users SET downloadbanned = 'no' WHERE id = '".$arr1["id"]."'");
SQL_Query_exec("UPDATE warnings SET expiry = '$timenow', active = 'no' WHERE userid = $arr1[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES ('0', '".$arr1["id"]."', '".$timenow."', '".$reason."', '0')");
}
}
//BAN WARNED USERS
$res = SQL_Query_exec("SELECT users.id, users.username, UNIX_TIMESTAMP(warnings.expiry) AS expiry FROM users INNER JOIN warnings ON users.id=warnings.userid WHERE type='Poor Ratio' AND active = 'yes' AND class = 1 AND enabled='yes' AND downloadbanned = 'yes' AND uploaded / downloaded < $minratio AND downloaded >= $downloaded");
if (mysqli_num_rows($res) > 0){
$timenow = get_date_time();
$expires = (86400 * $length);
while ($arr = mysqli_fetch_assoc($res)){
if (gmtime() - $arr["expiry"] >= 0) {
SQL_Query_exec("UPDATE users SET enabled='no', downloadbanned='no' WHERE id='".$arr["id"]."'");
write_log("User <a href='account-details.php?id=".$arr["id"]."'>".$arr["username"]."</a> has been banned (Auto Leech warning).");
}
}
}
}//check if warning system is on
// REMOVE WARNINGS
$res = 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 downloadbanned = 'yes' AND enabled='yes' AND warnings.active = 'yes' AND warnings.expiry < '".get_date_time()."'");
while ($arr1 = mysqli_fetch_assoc($res)){
SQL_Query_exec("UPDATE users SET downloadbanned = 'no' WHERE id = $arr1[id]");
SQL_Query_exec("UPDATE warnings SET active = 'no' WHERE userid = $arr1[id] AND expiry < '".get_date_time()."'");
write_log("Removed warning for $arr1[username]. Expiry: $arr1[expiry]");
}
// WARN USERS THAT STILL HAVE ACTIVE WARNINGS
SQL_Query_exec("UPDATE users SET downloadbanned = 'yes' WHERE warned = 'no' AND id IN (SELECT userid FROM warnings WHERE active = 'yes')");
//END//
Last edited by niki on 2023-08-29 09:45:52