$gigs = 25*1073741824; // 25 GB
$res = mysql_query("SELECT id FROM users WHERE class = 1 AND uploaded >= $gigs AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysql_fetch_assoc($res)) {
mysql_query("UPDATE users SET class = 2 WHERE id = $arr[id]");
mysql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'You have been automatically promoted from User to Power User, If your ratio drops below 1.00 you will be demoted.', 'You have been promoted to: Power User')");
}
$res = mysql_query("SELECT id FROM users WHERE class = 2 AND uploaded >= $gigs AND uploaded < downloaded");
while ($arr = mysql_fetch_assoc($res)) {
mysql_query("UPDATE users SET class = 1 WHERE id = $arr[id]");
mysql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'You have been automatically demoted from Power User to User.', 'You have been demoted to User')");
}
that should work for any User that has uploaded 25+GBs and has a ratio over 1