game/cron/battle_save.php
2022-06-07 00:30:34 +03:00

131 lines
5.7 KiB
PHP
Raw Blame History

<?php
define('GAME',true);
setlocale(LC_CTYPE ,"ru_RU.CP1251");
include('/home/newcom1/public_html/_incl_data/__config.php');
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
include('/home/newcom1/public_html/_incl_data/class/__user.php');
/*
CRON Î÷èñòêè ñåðâåðà îò íåíóæíîé èíôîðìàöèè
Äåéñòâèÿ:
1. Î÷èñòêà ÷àòà
2. Î÷èñòêà çàÿâîê â ïîåäèíêè
3. Î÷èñòêà çàÿâîê â ïåùåðû
4. Î÷èñòêà ïîõîäîâ
5. <20>îåâ äî òåêóùèõ
*/
// ‡àßâêè â êëàí
mysql_query('UPDATE `users` SET `clan_zv`=0 WHERE `clan_zv`>0');
//1. Î÷èñòêà ÷àòà, îñòàåòñÿ ÷àò
mysql_query('DELETE FROM `chat` WHERE `time` < "'.(time()-1000).'"');
mysql_query('DELETE FROM `chat_system` WHERE `time` < "'.(time()-1000).'"');
//2. Î÷èñòêà çàÿâîê â ïîåäèíêè
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "'.(time()-43200*1).'"');
//3. Î÷èñòêà çàÿâîê â ïåùåðû
mysql_query('DELETE FROM `dungeon_zv` WHERE `delete` > 0 OR `time` < "'.(time()-43200*1).'"');
//4. Î÷èñòêà ïîõîäîâ
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_start` < "'.(time()-43200*1).'" OR `time_finish` > 0');
while( $pl = mysql_fetch_array($sp) ) {
mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "'.$pl['id'].'"');
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "'.$pl['id'].'"');
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "'.$pl['id'].'"');
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "'.$pl['id'].'"');
mysql_query('DELETE FROM `dungeon_now` WHERE `id` = "'.$pl['id'].'"');
}
//5. Î÷èñòêà áàíîâ - 10 äíåé
$dusr = mysql_query('SELECT * FROM `users` WHERE `banned` < "'.(time()-86400*10).'" AND `banned` > 0');
while( $ddusr = mysql_fetch_array($dusr) ) {
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$ddusr['id'].'"');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$ddusr['id'].'"');
//“äàëßåì ñòàòû è ïîëå â þçåðñ
mysql_query('DELETE FROM `users` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `rep` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `online` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
}
//6. ÷èñòêà îòñóòñòâóþùèç 30 äíåé
$dusr = mysql_query('SELECT * FROM `users` WHERE `online` < "'.(time()-86400*30).'" AND `online` > 0 AND `level` < 10');
while( $ddusr = mysql_fetch_array($dusr) ) {
mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$ddusr['id'].'"');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$ddusr['id'].'"');
//“äàëßåì ñòàòû è ïîëå â þçåðñ
mysql_query('DELETE FROM `users` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `rep` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `online` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$ddusr['id'].'" LIMIT 1');
}
//7. ÷èñòêà ßâíûõ áîòîâ
mysql_query('DELETE FROM `users` WHERE `ip` = "0" AND `online` = "0" AND `battle` = "0"');
//8. ÷èñòêà ëîãîâ ïåðåäà÷ -10 äíåé
mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*10).'"');
//9. ÷èñòêà âåùåé íåïðåíàäëåæàùèõ íå êîìó
mysql_query('DELETE FROM `items_users` WHERE `items_users`.`uid` > 0 AND `items_users`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `items_users`');
//9.1. ÷èñòêà ýôåêòîâ
mysql_query('DELETE FROM `eff_users` WHERE `eff_users`.`uid` > 0 AND `eff_users`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `eff_users`');
//9.2. ÷èñòêà users_achiv
mysql_query('DELETE FROM `users_achiv` WHERE `users_achiv`.`id` > 0 AND `users_achiv`.`id` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `users_achiv`');
//9.3. ÷èñòêà aaa_bonus
mysql_query('DELETE FROM `aaa_bonus` WHERE `aaa_bonus`.`uid` > 0 AND `aaa_bonus`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `aaa_bonus`');
//9.4. ÷èñòêà `users_delo`
mysql_query('DELETE FROM `users_delo` WHERE `users_delo`.`uid` > 0 AND `users_delo`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `users_delo`');
//9.5. ÷èñòêà users_reting
mysql_query('DELETE FROM `users_reting` WHERE `users_reting`.`uid` > 0 AND `users_reting`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `users_reting`');
//9.6. ÷èñòêà `aaa_reting_list`
mysql_query('DELETE FROM `aaa_reting_list` WHERE `aaa_reting_list`.`uid` > 0 AND `aaa_reting_list`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `aaa_reting_list`');
//9.7 rep
mysql_query('DELETE FROM `rep` WHERE `rep`.`id` > 0 AND `rep`.`id` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `rep`');
//9.8 aaa_znahar
mysql_query('DELETE FROM `aaa_znahar` WHERE `aaa_znahar`.`uid` > 0 AND `aaa_znahar`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `aaa_znahar`');
//9.9 user_operation
mysql_query('DELETE FROM `user_operation` WHERE `user_operation`.`uid` > 0 AND `user_operation`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
//mysql_query('OPTIMIZE TABLE `user_operation`');
//10. ÷èñòêà actions
mysql_query('DELETE FROM `actions` WHERE `vars`= "day_quest"');
mysql_query('DELETE FROM `actions` WHERE `time` < "'.(time()-86400*60).'" AND `vars` != "read"');
mysql_query('DELETE FROM `actions` WHERE `actions`.`uid` > 0 AND `actions`.`uid` NOT IN (SELECT `users`.`id` FROM `users`)');
mysql_query('DELETE FROM `actions` WHERE `vals`= "loto"');
//mysql_query('OPTIMIZE TABLE `actions`');
//—èñòêà ãîëîñîâîãî ÷àòà
mysql_query('DELETE FROM `uploads` WHERE `id` > 0');
?>