Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent) > Mods & Themes
Reply
  #1  
Old 17th January 2010, 08:51
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default Auto Promote/Demote user
these functions well auto promote and demote users By upload and ratio
Open include/cleanup.php

add to before
Code:
function getscrapedata($url) {
Code:
/*Auto Prommote system By joeroberts
To Use call to function in clean up You Must use a new call for each level you want to Promote
autopromote(10,2,1.1,"Power User","user");
autpromote(
$upload = user with upload equle or greater then
$bite = Type of byte Meg Gig Tera
$ratio = user with ratio equle or better then
$new_level = New level to promote to
$old_level = select from user in this level 
)
*/
function autopromote($upload, $bite="1", $ratio, $new_level, $old_level){
       global $db, $db_prefix;
$mb = 1024*1024;
$gb = 1024*1024*1024;
$tb = 1024*1024*1024*1024;
if ($bite == '1')
    $upload = $mb*$upload;
elseif ($bite == '2')
    $upload = $gb*$upload;
elseif ($bite == '3')
    $upload = $tb*$upload;
else return;
    $res1 ="SELECT id FROM ".$db_prefix."_users WHERE  can_do = '".$old_level."' AND active = 1 AND uploaded >= $upload AND uploaded / downloaded >= $ratio AND warned = '0'" ;
$res =$db->sql_query($res1)or btsqlerror($res1);
    $prouser = array();
       while ($arr = $db->sql_fetchrow($res))
       {
        $prouser[] = $arr['id'];
}
$db->sql_freeresult($res);
if(count($prouser) > 0)
  $db->sql_query("UPDATE ".$db_prefix."_users SET  can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET  can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); 
}
/*Auto Demotion system By joeroberts
To Use call to function in clean up You Must use a new call for each level you want to demote
autodemote(1.0, "user", "Power User");
autodemote(
$ratio = user with ratio less then
$new_level New Level for user
$old_level Level From sich to demote from
)
*/
function autodemote($ratio, $new_level, $old_level){
       global $db, $db_prefix;
    $res1 ="SELECT id FROM ".$db_prefix."_users WHERE  can_do = '".$old_level."' AND active = 1 AND uploaded / downloaded < $ratio AND warned = '0'" ;
$res =$db->sql_query($res1)or btsqlerror($res1);
    $prouser = array();
       while ($arr = $db->sql_fetchrow($res))
       {
        $prouser[] = $arr['id'];
}
$db->sql_freeresult($res);
if(count($prouser) > 0)
  $db->sql_query("UPDATE ".$db_prefix."_users SET  can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET  can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); 
}
To activate this find in same file
Code:
autoclean();
and add before something like this
Code:
autopromote(10,2,1.1,"Power User","user");
autodemote(1.0, "user", "Power User");
__________________
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
  #2  
Old 7th February 2010, 13:55
cop1976's Avatar
cop1976 cop1976 is offline
Senior Member
 
Join Date: May 2009
United Kingdom
Posts: 30
Default
With all respect, but it does not work for me.
Reply With Quote
  #3  
Old 7th February 2010, 14:31
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
please give me example
__________________
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
  #4  
Old 7th February 2010, 17:35
cop1976's Avatar
cop1976 cop1976 is offline
Senior Member
 
Join Date: May 2009
United Kingdom
Posts: 30
Default
I add this code before function getscrapedata

Code:
/*Auto Prommote system By joeroberts
To Use call to function in clean up You Must use a new call for each level you want to Promote
autopromote(10,2,1.1,"Power User","user");
autpromote(
$upload = user with upload equle or greater then
$bite = Type of byte Meg Gig Tera
$ratio = user with ratio equle or better then
$new_level = New level to promote to
$old_level = select from user in this level 
)
*/
function autopromote($upload, $bite="1", $ratio, $new_level, $old_level){
       global $db, $db_prefix;
$mb = 1024*1024;
$gb = 1024*1024*1024;
$tb = 1024*1024*1024*1024;
if ($bite == '1')
    $upload = $mb*$upload;
elseif ($bite == '2')
    $upload = $gb*$upload;
elseif ($bite == '3')
    $upload = $tb*$upload;
else return;
    $res1 ="SELECT id FROM ".$db_prefix."_users WHERE  can_do = '".$old_level."' AND active = 1 AND uploaded >= $upload AND uploaded / downloaded >= $ratio AND warned = '0'" ;
$res =$db->sql_query($res1)or btsqlerror($res1);
    $prouser = array();
       while ($arr = $db->sql_fetchrow($res))
       {
        $prouser[] = $arr['id'];
}
$db->sql_freeresult($res);
if(count($prouser) > 0)
  $db->sql_query("UPDATE ".$db_prefix."_users SET  can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET  can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); 
}
/*Auto Demotion system By joeroberts
To Use call to function in clean up You Must use a new call for each level you want to demote
autodemote(1.0, "user", "Power User");
autodemote(
$ratio = user with ratio less then
$new_level New Level for user
$old_level Level From sich to demote from
)
*/
function autodemote($ratio, $new_level, $old_level){
       global $db, $db_prefix;
    $res1 ="SELECT id FROM ".$db_prefix."_users WHERE  can_do = '".$old_level."' AND active = 1 AND uploaded / downloaded < $ratio AND warned = '0'" ;
$res =$db->sql_query($res1)or btsqlerror($res1);
    $prouser = array();
       while ($arr = $db->sql_fetchrow($res))
       {
        $prouser[] = $arr['id'];
}
$db->sql_freeresult($res);
if(count($prouser) > 0)
  $db->sql_query("UPDATE ".$db_prefix."_users SET  can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET  can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); 
}
and before autoclean i add

Code:
autopromote(25,2,1.0,"power_user","user");
autodemote(0.9, "user", "power_user");
autopromote(100,2,2.0,"super_user","power_user");
autodemote(1.9, "power_user", "super_user");
autopromote(500,2,3.0,"elite_user","super_user");
autodemote(2.9, "super_user", "elite_user");
I promote manualy user to power user who had only 10 GB upload, and system don't demote him.
Reply With Quote
  #5  
Old 7th February 2010, 17:44
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
what was your ratio?
__________________
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
  #6  
Old 7th February 2010, 18:05
cop1976's Avatar
cop1976 cop1976 is offline
Senior Member
 
Join Date: May 2009
United Kingdom
Posts: 30
Default
More than 1.0, but upload was only 10 gb.
Reply With Quote
  #7  
Old 7th February 2010, 18:19
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
well only demote By ratio as it takes into mind if you had the uploads to get to that level then that should not change
__________________
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
  #8  
Old 7th February 2010, 18:37
cop1976's Avatar
cop1976 cop1976 is offline
Senior Member
 
Join Date: May 2009
United Kingdom
Posts: 30
Default
Why the code does not pay attention to upload, only the ratio? For what is the number of upload in this code?
Thx for answer, but autopromote and demote users would be very helpful.
Is there any possibility to make it work properly?
__________________
http://bvlist.com/images/avatars/signaturepics/sigpic5839_1.gif
Reply With Quote
  #9  
Old 7th February 2010, 18:42
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
it pays attention in the promote part not the demote part it is easy to make it to so though give me a day as I got something else going now.
__________________
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
  #10  
Old 7th February 2010, 18:45
cop1976's Avatar
cop1976 cop1976 is offline
Senior Member
 
Join Date: May 2009
United Kingdom
Posts: 30
Default
Ok thx and btw great job ;)

Bump: Is it possible that the system sends a message to the user about the promotion or degradation, and to add an entry in the mod comment with the exact date when it was done?
__________________
http://bvlist.com/images/avatars/signaturepics/sigpic5839_1.gif
Reply With Quote
Reply

Tags
auto , promote or demote , user

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
TSSE 4.3/5.1 Cant promote a user to moderator BEA Template Shares 5 30th November 2008 15:23
how change the normal user to power or admin user in ts TS Special Edition v.5.1 theway Template Shares 2 27th September 2008 14:44
Auto promote uploaders kristaps Mods & Themes 0 2nd September 2008 21:17
Demote uploader automatically kp380lv Mods & Themes 0 29th August 2008 12:36
I can't promote users to adminstrator class!!!Help kp380lv Yuna Scatari Edition (YSE) 4 4th August 2008 00:06



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