it is not autopromote when the ratio is over 1.1
$limit = 100*1024*1024*1024;
$limitdown = 50 * 1024 * 1024 * 1024;
$minratio = 1.1;
$maxdt = sqlesc(get_date_time(gmtime() - 86400*28));
$res = SQL_Query_exec("SELECT id, username FROM users WHERE class = 1 AND uploaded >= $limit AND downloaded >= $limitdown AND uploaded / downloaded >= $minratio AND added < $maxdt");
if (mysqli_num_rows($res) > 0)
{
$dt = sqlesc(get_date_time());
$msg = sqlesc("Congratulations, you have been auto-promoted from Member to Power User by System.");
while ($arr = mysqli_fetch_assoc($res))
{
SQL_Query_exec("UPDATE users SET class = 2 WHERE id = $arr[id]") ;
SQL_Query_exec("UPDATE users SET invites = invites +2 WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $arr[id], $dt, $msg, 0)");
write_log("User <a href=account-details.php?id=".$arr["id"].">".$arr["username"]."</a> Was automatically promoted from Member to Power User by System.");
}
}
Last edited by djlive on 2022-04-11 04:43:40
