game/cron/battle_save.php

127 lines
5.6 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
const GAME = true;
2022-06-06 21:30:34 +00:00
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
/*
CRON <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
3. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
4. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
5. <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
mysql_query('UPDATE `users` SET `clan_zv`=0 WHERE `clan_zv`>0');
//1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
mysql_query('DELETE FROM `chat` WHERE `time` < "'.(time()-1000).'"');
mysql_query('DELETE FROM `chat_system` WHERE `time` < "'.(time()-1000).'"');
//2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "'.(time()-43200*1).'"');
//3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mysql_query('DELETE FROM `dungeon_zv` WHERE `delete` > 0 OR `time` < "'.(time()-43200*1).'"');
//4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - 10 <20><><EFBFBD><EFBFBD>
$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'].'"');
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 30 <20><><EFBFBD><EFBFBD>
$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'].'"');
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
mysql_query('DELETE FROM `users` WHERE `ip` = "0" AND `online` = "0" AND `battle` = "0"');
//8. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -10 <20><><EFBFBD><EFBFBD>
mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*10).'"');
//9. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> `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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> `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. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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`');
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mysql_query('DELETE FROM `uploads` WHERE `id` > 0');