Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev > Mods & Themes
Reply
  #1  
Old 11th August 2013, 12:29
MJUER MJUER is offline
Senior Member
 
Join Date: Aug 2012
P2P
Posts: 23
Cool Auto Leech Warning
Ad this in Sql

ALTER TABLE users ADD `lowratio` enum('yes','no')


And this in cleanup.php
PHP Code:
    $minratio 0.5;                    // min ratio
    
$downloaded 1*1024*1024*1024;        // min gigs downloaded
    
$length 2*7;                        // days to warn

    // ADD WARNING
    
$res mysql_query("SELECT id, username, modcomment, uploaded, downloaded, lowratio FROM users WHERE class = 1 AND warned = 'no' AND enabled= 'yes' AND uploaded / downloaded < $minratio AND downloaded >= $downloaded");

    if (
mysql_num_rows($res) > 0){
        
$timenow get_date_time();
        
$reason "Ai fost avertizat pentru ca ai ratia prea mica. Trebuie sa o ridici peste [b]".$minratio."[/b] in urmatoarele [b]".$length."[/b] zile sau contul tau va fi dezactivat.";

        
$until sqlesc(get_date_time(gmtime() + ($length*86400)));

        while (
$arr mysql_fetch_assoc($res)){
            
$ratio number_format($arr["uploaded"] / $arr["downloaded"], 3);
            
$modcomment htmlspecialchars($arr["modcomment"]);
            
$modcomment gmdate("Y-m-d H:i") . " - Warned for low ratio by System.\n(UL=".prefixed($arr['uploaded']).", DL=".prefixed($arr['downloaded']).", Ratio=".$ratio.")\n".$modcomment;
            
$modcom sqlesc($modcomment);
            
mysql_query("UPDATE users SET warned = 'yes', warneduntil = $until, lowratio = 'yes', modcomment = $modcom WHERE id=$arr[id]");
            
mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES ('0', '".$arr["id"]."', '".$timenow."', '".$reason."', '0')");
            
write_log("Auto Leech Warning has been added for: <b>".$arr["username"]."</b>");
        }
    }

        
// REMOVE WARNING
    
$res1 mysql_query("SELECT users.id, users.username FROM users WHERE warned = 'yes'  AND enabled='yes' AND lowratio='yes' AND uploaded / downloaded >= $minratio AND downloaded >= $downloaded");
    if (
mysql_num_rows($res1) > 0){
        
$timenow get_date_time();
        
$reason "Avertizarea pentru ratie prea mica a fost inlaturata. Pastreaza ratia la o valoare ridicata pentru a nu fi avertizat din nou.\n";

        while (
$arr1 mysql_fetch_assoc($res1)){
            
mysql_query("UPDATE users SET warned = 'no', warneduntil = '0000-00-00 00:00:00', lowratio = 'no' WHERE id = '".$arr1["id"]."'");
            
mysql_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES ('0', '".$arr1["id"]."', '".$timenow."', '".$reason."', '0')");
            
write_log("Auto Leech Warning has been removed for: <b>".$arr1["username"]."</b>");
        }
    }

    
// DISABLE WARNED USERS
    
$res mysql_query("SELECT id, username FROM users WHERE warned='yes' AND warneduntil < NOW() AND warneduntil <> '0000-00-00 00:00:00' AND lowratio='yes'") or sqlerr(__FILE____LINE__); 
    if (
mysql_num_rows($res) > 0){
        while (
$arr mysql_fetch_assoc($res)){
        
mysql_query("UPDATE users SET enabled = 'no', warneduntil = '0000-00-00 00:00:00' WHERE id = $arr[id]") or sqlerr(__FILE____LINE__);
        }
    } 
Reply With Quote
  #2  
Old 11th August 2013, 13:53
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
You should add a default to that sql query like so
Code:
ALTER TABLE users ADD `lowratio` enum('yes','no') DEFAULT 'no',
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #3  
Old 26th September 2018, 12:01
guldhammer guldhammer is offline
Banned
 
Join Date: Jan 2010
Saint Lucia
Posts: 59
Default
There is no cleanup.php in TBDev TBDev_2010_revision_464
Reply With Quote
Reply

Tags
auto , leech , warning

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 14:18. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.