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');