Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
More Groups Automated V3
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2019-04-02 08:14:53
This mod adds 11 groups to v3 and some of them are automated, it includes the class colour function mod by bigmax.
The only issue i had so far is members who signup are class 2 but members who signup using invites are class 1, its designed for people with ratio below 1 to be restricted so ideally all new members should be class 2

// Owner
// Admin
// Super Mod
// Moderator
// VIP
// Uploader
// Addict - if uploaded 250GB more than download
// Pro User - if uploaded 150GB more than download
// Power User - if uploaded 50GB more than download
// Member -  this is new base class with minum ratio of 1
// Leecher - any user with ratio below 0.9 is demoted here and can not download

SQL
Change all normal users to class 2 & update owner class
UPDATE users SET class = '2' WHERE class = '1'
UPDATE users SET class = '11' WHERE class = '7'




DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
 `group_id` int(10) NOT NULL AUTO_INCREMENT,
 `level` varchar(50) NOT NULL DEFAULT '',
 `view_torrents` enum('yes','no') NOT NULL DEFAULT 'yes',
 `edit_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
 `delete_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
 `view_users` enum('yes','no') NOT NULL DEFAULT 'yes',
 `edit_users` enum('yes','no') NOT NULL DEFAULT 'no',
 `delete_users` enum('yes','no') NOT NULL DEFAULT 'no',
 `view_news` enum('yes','no') NOT NULL DEFAULT 'yes',
 `edit_news` enum('yes','no') NOT NULL DEFAULT 'no',
 `delete_news` enum('yes','no') NOT NULL DEFAULT 'no',
 `can_upload` enum('yes','no') NOT NULL DEFAULT 'no',
 `can_download` enum('yes','no') NOT NULL DEFAULT 'yes',
 `view_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
 `edit_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
 `delete_forum` enum('yes','no') NOT NULL DEFAULT 'no',
 `control_panel` enum('yes','no') NOT NULL DEFAULT 'no',
 `staff_page` enum('yes','no') NOT NULL DEFAULT 'no',
 `staff_public` enum('yes','no') NOT NULL DEFAULT 'no',
 `staff_sort` tinyint(3) unsigned NOT NULL DEFAULT '0',
 UNIQUE KEY `base` (`group_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;

INSERT INTO `groups` (`group_id`, `level`, `view_torrents`, `edit_torrents`, `delete_torrents`, `view_users`, `edit_users`, `delete_users`, `view_news`, `edit_news`, `delete_news`, `can_upload`, `can_download`, `view_forum`, `edit_forum`, `delete_forum`, `control_panel`, `staff_page`, `staff_public`, `staff_sort`) VALUES
(1, 'Leecher', 'yes', 'no', 'no', 'no', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'yes', 'no', 'no', 'no', 'no', 'no', 1),
(2, 'Member', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 2),
(3, 'Power User', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 3),
(4, 'Pro User', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 4),
(5, 'Addict', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 5),
(6, 'Uploader', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'yes', 6),
(7, 'VIP', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'yes', 7),
(8, 'Moderator', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 8),
(9, 'Super Mod', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 9),
(10, 'Admin', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 10),
(11, 'Owner', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 11);



In functions before the last ?> ( if colour function mod already installed just update)

////////////////////modcolor
//start class colors function
function class_user($name) {
global $site_config;
$a ="SELECT class, donated, warned, enabled FROM `users` WHERE username ='".$name."'";
$res = SQL_Query_exec($a);
$classy = @mysqli_fetch_row($res);
switch ($classy[0]) {

case 11: // Owner
$col = "".$site_config["owner_color"]."";
break;
case 10: // Admin
$col = "".$site_config["admin_color"]."";
break;
case 9: // Super Mod
$col = "".$site_config["super_mod_color"]."";
break;
case 8: // Moderator
$col = "".$site_config["moderator_color"]."";
break;
case 7: // VIP
$col = "".$site_config["vip_color"]."";
break;
case 6: // Uploader
$col = "".$site_config["uploader_color"]."";
break;
case 5: // Addict
$col = "".$site_config["addict_color"]."";
break;
case 4: // Pro User
$col = "".$site_config["pro_user_color"]."";
break;
case 3: // Power User
$col = "".$site_config["power_user_color"]."";
break;
case 2: // Member
$col = "".$site_config["member_color"]."";
break;
case 1: // Leecher
$col = "".$site_config["leecher_color"]."";

}if($classy[1]>0){
$star="<img src='".$site_config[SITEURL]."/images/star.png' alt='donated' border='0'>";
}else{ $star="";}
if($classy[2]=="yes"){
$warn="<img src='".$site_config[SITEURL]."/images/warned.png' alt='warned' border=0>";
}else{ $warn=""; }
if($classy[3]=="no"){
$disabled="<img src='".$site_config[SITEURL]."/images/disabled.png' alt='disabled' border=0>";
}else{ $disabled=""; }
return unesc("<font color='".$col."'>".$name."".$star."".$warn."".$disabled."</font>");
}
//end class colors function


In config add ( if colour function mod already installed just update)

// class colors
$site_config['owner_color'] = '#FF0000';  // Owner / Red
$site_config['admin_color'] = '#ff9900';  // Admin / Maroon
$site_config['super_mod_color'] = '#00ff00';   // Super Mod / Lime
$site_config['moderator_color'] = '#00cc00';  // Moderator / Green
$site_config['vip_color'] = '#d9bb24';  // VIP / Gold
$site_config['uploader_color'] = '#ffff00';  // Uploader / Yellow
$site_config['addict_color'] = '#0000ff';  // Addict / Blue
$site_config['pro_user_color'] = '#005080';  // Pro User / Navy
$site_config['power_user_color'] = '#008080';  // Power User / Teal
$site_config['member_color'] = '#fff';  // Member / Black
$site_config['leecher_color'] = '#ff00ff';  // Leecher / Pink


in account_signup.php find ( now new members are class 2 )
$signupclass = '1';


change to
$signupclass = '2';


In cleanup.php find
//ORIGINAL OPTIMIZE TABLES


Add before

//===| Start Auto Promote/Demote Users |===//

//===| config
$minratio = 0.9; # ratio for demotion to LEECHER

$gigs3 = 50 * 1073741824; # 50 GB
$gigs4 = 150 * 1073741824; # 150 GB
$gigs5 = 250 * 1073741824; # 250 GB

$class1 = 1; // class 1
$class2 = 2; // class 2
$class3 = 3; // class 3
$class4 = 4; // class 4
$class5 = 5; // class 5

$delay2 = sqlesc(get_date_time(gmtime() - 1 * 1)); # Joined > 1 month


// auto promote to class 2 has ratio above 1
$res = SQL_Query_exec("SELECT id, username FROM users WHERE class = 1 AND uploaded / downloaded > $minratio");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
   $res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class2 LIMIT 1");
   if (mysqli_num_rows($res_classname) == 1) {
       $arr_classname = mysqli_fetch_assoc($res_classname);
       $new_classname = "$arr_classname[level]";
   }
   $username = $arr[username];
   SQL_Query_exec("UPDATE users SET class = $class2 WHERE id = $arr[id]");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Member class. Please note that if your ratio drops below " . $minratio . " at any time,  you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
   unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}

// auto demote to leecher members with ratio below 1
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE (class = $class2 || class = $class3 || class = $class4 || class = $class5) AND uploaded / downloaded < $minratio");
while ($arr = mysqli_fetch_assoc($res)) {
   $username = $arr[username];
   $modcomment = $arr[modcomment];
   $modcomment2 = gmdate("d-M-Y") . " - Has been demoted by System to Leecher \n";
   $modcomment = $modcomment2 . "" . $modcomment;
   $modcom = sqlesc($modcomment);
   SQL_Query_exec("UPDATE users SET class = 1, modcomment = CONCAT($modcom,modcomment) WHERE id = $arr[id]");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'You were automatically demoted to Leecher. That happened because your ratio dropped below " . $minratio . "', 'You have been demoted to Leecher')");
   write_log("<a href=account-details.php?id=$arr[id]><b>$username</b></a> has been demoted by System to <b>Leecher</b> class");
}

// auto promote to class 3
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs3 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
   $res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class3 LIMIT 1");
   if (mysqli_num_rows($res_classname) == 1) {
       $arr_classname = mysqli_fetch_assoc($res_classname);
       $new_classname = "$arr_classname[level]";
   }
   $username = $arr[username];
   SQL_Query_exec("UPDATE users SET class = $class3 WHERE id = $arr[id]");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Power User class. Please note that if your ratio drops below " . $minratio . " at any time,  you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
   unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
// auto promote to class 4
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2 || class = $class3) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs4 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
   $res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class4 LIMIT 1");
   if (mysqli_num_rows($res_classname) == 1) {
       $arr_classname = mysqli_fetch_assoc($res_classname);
       $new_classname = "$arr_classname[level]";
   }
   $username = $arr[username];
   SQL_Query_exec("UPDATE users SET class = $class4 WHERE id = $arr[id]");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Pro User class. Please note that if your ratio drops below " . $minratio . " at any time,  you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
   unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
// auto promote to class 5
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2 || class = $class3 || class = $class4) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs5 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
   $res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class5 LIMIT 1");
   if (mysqli_num_rows($res_classname) == 1) {
       $arr_classname = mysqli_fetch_assoc($res_classname);
       $new_classname = "$arr_classname[level]";
   }
   $username = $arr[username];
   SQL_Query_exec("UPDATE users SET class = $class5 WHERE id = $arr[id]");
   SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Addict class. Please note that if your ratio drops below " . $minratio . " at any time,  you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
   unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}



[color=rgb(251, 160, 38)]I also have automation & demotion for uploaders from TTfr just add after the code above (cleanup.php)[/color]
// uploader mod test promote if 3 uploads in 2 weeks
$query = SQL_Query_exec('SELECT torrents.owner, COUNT(*)  AS counta FROM torrents INNER JOIN users ON (torrents.owner=users.id) WHERE users.class < "4" and users.donated = "0" and torrents.banned = "no" and torrents.added > DATE_SUB(NOW(), INTERVAL 15 DAY) GROUP BY torrents.owner');

while ($UP = mysqli_fetch_assoc ($query)){
   if ($UP['counta'] > 3){
       SQL_Query_exec ('UPDATE users SET class = 6 WHERE id = ' . sqlesc ($UP['owner']).'');
       $subject = 'Automatic Promotion To Uploader Status';
       $msg = 'Hello you did 1 upload, you are promoted to Uploader, Bravo !!! ';
SQL_Query_exec("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES ('0', '".$UP[owner]."','".get_date_time()."', '$subject', '$msg', 'yes', 'in')");
       }
   }

// Uploader demote if he did not upload 1 torrent over 2 week
$nbre = 0;
$query = SQL_Query_exec('SELECT id, username FROM users WHERE class = 6 ');
while ($up = mysqli_fetch_assoc ($query)){
   $query2 = SQL_Query_exec('SELECT name, added, DATE_SUB(NOW(), INTERVAL 15 DAY) AS date_expiration FROM torrents WHERE owner = '.$up['id'].'');
   while ($up2 = mysqli_fetch_assoc ($query2)){
       if ($up2["added"] > $up2["date_expiration"])
           $nbre = $nbre + 1;
       else
           $nbre = $nbre;
       }

   if ($nbre < 1){
       SQL_Query_exec('UPDATE users SET class = 2 WHERE id = ' . sqlesc ($up['id']).'');
       $subject = 'Automatic Downgrading to Member Status';
       $msg = 'You have not uploaded in the last fortnight so you have been demoted from uploader.';
       SQL_Query_exec("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES ('0', '".$up[id]."', '".get_date_time()."', '$subject', '$msg', 'yes', 'in')");
       }

   $nbre = 0;
   }  


[color=rgb(251, 160, 38)]In footer.php add links if you wish find[/color]
<!-- START FOOTER CODE -->


before

<center><a href="memberlist.php?search=&class=11"><font size="2"  color="#cc0000"><b>Owner</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=10"><font size="2"  color="#ff9900"><b>Admin</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=9"><font size="2"  color="#00ff00"><b>Super Mod</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=8"><font size="2"  color="#00cc00"><b>Moderator</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=7"><font size="2"  color="#d9bb24"><b>VIP</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=6"><font size="2"  color="#FFff00"><b>Uploader</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=5"><font size="2"  color="#0000ff"><b>Addict</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=4"><font size="2"  color="#005080"><b>Pro User</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=3"><font size="2"  color="#008080"><b>Power User</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=2"><font size="2"  color="#fff"><b>Member</b></font></a>&nbsp;&nbsp;
<a href="memberlist.php?search=&class=1"><font size="2"  color="#ff00ff"><b>Leecher</b></font></a>&nbsp;&nbsp;
</center><br />
2019-04-04 14:31:09
what if i already have class color function installed?
2019-04-04 16:47:27
Just replace it m8 in functions & config
Unknown User
2019-04-04 16:58:17
lol what a mess lol what you doing here never seen this before crap code,what you doing putting code in the footer for lol Do you know where to put it lol muppet
2019-04-04 17:35:26
If you don't like dont use it retard you need banning you don't contribute, spam every topic it's become annoying and you can't spell for shit, there's something really wrong with you
Unknown User
2019-04-04 20:51:22
says u who can not spell in the code lol take a look shit coder
2019-04-05 06:16:02
i have added it but the color of groups is not changing. Also some questions. I have done before footer.php where in footer.php the code needs to be added? and the auto promote in which file to add?
Screenshot_1.png
Screenshot_1.png
2019-04-05 08:19:14
this changes the user name colour so wont show up on the groups in staff panel, ill update first post to add where in footer and for auto promote uploaders
2019-12-11 11:21:02
I am facing an issue. I want to set an uploader manually but it failed. how to set manual uploader
2020-01-03 15:55:10
Just a small one >>

UPDATE users SET class = '2' WHERE class = '1'
UPDATE users SET class = '11' WHERE class = '7'


should be

UPDATE users SET class = '2' WHERE class = '1';
UPDATE users SET class = '11' WHERE class = '7';

If It Ain't Dutch, It Ain't Much!!
2020-01-03 16:01:12
I think it should also be mentioned, that you have to check each file that might be affected by the change in user class.
For example = where owner was class 7, and options that were restricted ONLY to the owner - will not be visible to all the mods/super mods and admins as well ;-)
Just a thought.

User class changes >>

[TABLE]
[TR]
[TH]OLD CLASSES[/TH]
[TH]NEW CLASSES[/TH]
[/TR]
[TR]
[TD][/TD]

[TD]case 11: // Owner[/TD]
[/TR]
[TR]
[TD]case 7: // Administrator[/TD]
[TD]case 10: // Admin[/TD]
[/TR]
[TR]
[TD]case 6: // Super Moderator[/TD]
[TD]case 9:  // Super Mod[/TD]
[/TR]
[TR]
[TD]case 5: // Moderator[/TD]
[TD]case 8:  // Moderator[/TD]
[/TR]
[TR]
[TD]case 3: // VIP[/TD]
[TD]case 7:  // VIP[/TD]
[/TR]
[TR]
[TD]case 4: // Uploader[/TD]
[TD]case 6:  // Uploader[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]case 5: // Addict (auto set)[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]case 4: // Pro User    (auto set)[/TD]
[/TR]
[TR]
[TD]case 2: // Power User[/TD]
[TD]case 3:  // Power User[/TD]
[/TR]
[TR]
[TD]case 1: // Member[/TD]
[TD]case 2:  // Member[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]case 1: // Leecher (auto set when ration below 0.9 (or whatever your setting))[/TD]
[/TR]
[/TABLE]

Here are some of the changes I have made, perhaps they are useful to you!

Find in torrents-upload.php


if ($site_config["UPLOADERSONLY"] && $CURUSER["class"] < 4)


and change to >>


if ($site_config["UPLOADERSONLY"] && $CURUSER["class"] < 6)


Find next:

if(get_user_class($CURUSER) > 4){


and change to >>


if(get_user_class($CURUSER) > 6){


Find in torrents-edit.php


if(get_user_class() >= 5)


Should be found 2 times, and change to >>


if(get_user_class() >= 8)


Find next:


if(get_user_class($CURUSER) > 6)


and change to >>


if(get_user_class($CURUSER) > 9)


Find in topten.php file (additional mod)


if (get_user_class() < 1)


and change to >>


if (get_user_class() < 3)


Find next:


$pu = get_user_class($CURUSER) >= 3;


and change to >>


$pu = get_user_class($CURUSER) >= 7;

If It Ain't Dutch, It Ain't Much!!
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728