в базу
Code
ALTER TABLE `users` ADD `oldclass` tinyint(3) default '0';
В cleanup.php:
Code
################################################
# мод "подарок вип статуса на др" от archmage.
################################################
// конфиги, конфиги..
$minratio = 1.50;
$timezone = 3; // здесь 3 - часовой пояс. Время московское, поправьте под себя.
$minuploaded = 50*1024*1024*1024;
$mindt = sqlesc(get_date_time(gmtime() - 86400*10));
// дальше не трогаем <img src="http://s39.ucoz.net/sm/24/smile.gif" border="0" align="absmiddle" alt="smile">
$dt = sqlesc(get_date_time());
$currentdate = date("Y-m-d", time() + $timezone * 60);
list($year1, $month1, $day1) = split('-', $currentdate);
$query = sql_query("SELECT id, birthday, class FROM users WHERE class < ".UC_VIP." AND uploaded / downloaded >= $minratio AND added < $mindt AND uploaded >= $minuploaded AND oldclass = 0 AND birthday != '0000-00-00'") or sqlerr(__FILE__,__LINE__);
while ($array = mysql_fetch_assoc($query))
{
$birthday = date($array["birthday"]);
$id = $array["id"];
$oldclass = $array["class"];
list($year2, $month2, $day2) = split('-', $birthday);
if (($month1 == $month2) && ($day1 == $day2)) {
$subject = sqlesc("С ДР!");
$msg = sqlesc("Администрация трекера поздравляет Вас с днём рождения! Примите от нас подарок вип на день! :).");
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject, poster) VALUES(0, $id, $dt, $msg, $subject, 0)") or sqlerr(__FILE__, __LINE__); ///use this if you DO NOT have the subject mod installed.///
sql_query("UPDATE users SET class = ".UC_VIP.", oldclass = ".$oldclass." WHERE id = ".$id);
}
}
$currentdate = date("Y-m-d", time() + $timezone * 60);
list($year1, $month1, $day1) = split('-', $currentdate);
$query = sql_query("SELECT id, birthday, oldclass FROM users WHERE oldclass != 0 AND birthday != $currentdate") or sqlerr(__FILE__, __LINE__);
while ($array = mysql_fetch_assoc($query)) {
$birthday = date($array["birthday"]);
$id = $array["id"];
$class = $array["oldclass"];
list($year2, $month2, $day2) = split('-', $birthday);
if ($month1 != $month2){
sql_query("UPDATE users SET class = ".$class.", oldclass = 0 WHERE id = ".$id) or sqlerr(__FILE__, __LINE__);
}
}
######################################################
# конец мод "подарок вип статуса на др" от archmage. #
######################################################