0 OR `cancel` > 0 OR `time` < "'.(time()-86400*1).'"'); //3. Очистка заявок в пещеры mysql_query('DELETE FROM `dungeon_zv` WHERE `delete` > 0 OR `time` < "'.(time()-86400*1).'"'); //4. Очистка походов $sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_start` < "'.(time()-86400*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. Очистка монстров $i = 0; $sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` ASC LIMIT 100000'); while( $pl = mysql_fetch_array($sp) ) { $btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1')); $clon = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$pl['id'].'" LIMIT 1')); if( (!isset($btl['id']) || $btl['team_win'] >= 0) && !isset($clon['id']) ) { //Очищаем бота delete_user_all( $pl['id'] , $pl['login'] ); $i++; } } $x = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `real` = 0 LIMIT 1')); $x = $x[0]; mysql_query('DELETE FROM `stats` WHERE `id` NOT IN (SELECT `id` FROM `users`);'); mysql_query('DELETE FROM `items_users` WHERE `delete` > `time_create` AND `delete` > 0'); //6. Очистка личного дела mysql_query('DELETE FROM `users_delo` WHERE `time` < "'.(time()-86400*30).'" LIMIT 10000'); //echo '