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
demote/promote auto
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2020-01-14 16:35:01
Hello I've tested this code but it doesn't work, can you help me to make it work, thanks in advance. (y):D



add to cleanup.php

add near the end

//heres another take on demote/promote auto

//promote member to power user


$limit = 25*1024*1024*1024;

$minratio = 1.05;

$maxdt = sqlesc(get_date_time(gmtime() - 86400*28));

$res = mysqli_query("SELECT id, username FROM users WHERE class = 1 AND uploaded >= $limit AND uploaded / downloaded >= $minratio AND added < $maxdt") or sqlerr(__FILE__, __LINE__);

if (mysqli_num_rows($res) > 0)

{

   $dt = sqlesc(get_date_time());

   $msg = sqlesc("Congratulations, you have been auto-promoted to Power User by SYSTEM.");

   while ($arr = mysqli_fetch_assoc($res))

   {

       mysqli_query("UPDATE users SET class = 2 WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);

       mysqli_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $arr[id], $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__);

       write_log("User <a href=account-details.php?id=".$arr["id"].">".$arr["username"]."</a> Was automatically promoted to POWERUSER by SYSTEM.");

   }

}







//Demote power-users to members and disable account

$limit = 25*1024*1024*1024;

$minratio = 0.75;

$maxdt = sqlesc(get_date_time(gmtime() - 86400*28));

$res = mysqli_query("SELECT id, username FROM users WHERE class = 2 AND uploaded <= $limit AND uploaded / downloaded <= $minratio AND added < $maxdt") or sqlerr(__FILE__, __LINE__);



if (mysqli_num_rows($res) > 0)

{

   $dt = sqlesc(get_date_time());

   //$msg = sqlesc("Congratulations, you have been auto-demoted to Member and account disabled by SYSTEM. Probably due to low ratio or account inactivity.");

   while ($arr = mysqli_fetch_assoc($res))

   {

       mysqli_query("UPDATE users SET class = 1, enabled = 'No' WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);

       //mysqli_query("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $arr[id], $dt, $msg, 0)")or sqlerr(__FILE__, __LINE__);

          write_log("User <a href=account-details.php?id=".$arr["id"].">".$arr["username"]."</a> Was automatically demoted to member and disabled by SYSTEM. Messages purged.");

       //remove any records belonging to this user in messages

             mysqli_query("DELETE FROM messages WHERE receiver = $arr[id]")or sqlerr(__FILE__, __LINE__);

   }

}
2020-01-15 08:37:34
Change mysqli_query to SQL_Query_exec
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2020-01-16 17:45:14
thank you very much for the support but it doesn't work the account update doesn't update automatically :eek:
2020-01-16 18:16:05
I had auto promote on my old modded one, did you do force cleanup in admincp
Class one was leeches
[URL unfurl="true"]https://github.com/M-jay84/TTv3/blob/master/upload/backend/functions/cleanup.php[/url]
2020-01-16 19:02:23
Thanks for your help. I'm gonna go clean up the admin cp and come back tomorrow and tell you what. (y):D


//promote membres en vip

$limit = 50*1024*1024*1024;

$minratio = 4.00;

$maxdt = sqlesc(get_date_time(gmtime() - 86400*28));

$res = SQL_Query_exec("SELECT id, username FROM users WHERE class = 1 AND uploaded >= $limit AND uploaded / downloaded >= $minratio AND added < $maxdt") or sqlerr(__FILE__, __LINE__);

if (mysqli_num_rows($res) > 0)

{

   $dt = sqlesc(get_date_time());

   $msg = sqlesc("BRAVO !!!, vous avez obtenu un compte VIP automatiquement par le systeme.");

   while ($arr = mysqli_fetch_assoc($res))

   {

       SQL_Query_exec("UPDATE users SET class = 3 WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);

       SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $arr[id], $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__);

       write_log("User <a href=account-details.php?id=".$arr["id"].">".$arr["username"]."</a> BRAVO !!! Vous avez un ratio de partage supĂ©rieur a 4.00 et vous avez obtenu un compte VIP automatiquement par le systeme.");

   }

}
2020-01-17 14:37:58
Hello I made the test in admin cp and it does not work the members do not update but automatically to vip members.
//promote membres en vip

$limit = 50*1024*1024*1024;

$minratio = 4.00;

$maxdt = sqlesc(get_date_time(gmtime() - 86400*28));

$res = SQL_Query_exec("SELECT id, username FROM users WHERE class = 1 AND uploaded >= $limit AND uploaded / downloaded >= $minratio AND added < $maxdt") or sqlerr(__FILE__, __LINE__);

if (mysqli_num_rows($res) > 0)

{

   $dt = sqlesc(get_date_time());

   $msg = sqlesc("BRAVO !!!, vous avez obtenu un compte VIP automatiquement par le systeme.");

   while ($arr = mysqli_fetch_assoc($res))

   {

       SQL_Query_exec("UPDATE users SET class = 3 WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);

       SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $arr[id], $dt, $msg, 0)") or sqlerr(__FILE__, __LINE__);

       write_log("User <a href=account-details.php?id=".$arr["id"].">".$arr["username"]."</a> BRAVO !!! Vous avez un ratio de partage supĂ©rieur a 4.00 et vous avez obtenu un compte VIP automatiquement par le systeme.");

   }

}
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728