= 8 && $test['count'] < 12) { mysql_query('UPDATE `battle` SET `timeout` = "120" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); } elseif ($test['count'] >= 12) { mysql_query('UPDATE `battle` SET `timeout` = "180" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); } } // batle cache mysql_query('DELETE FROM `battle_cache` WHERE `time` < "'.(time()-3600).'"'); //mysql_query('OPTIMIZE TABLE `battle_cache`'); // (1-5 ) $sp = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `type` = 33 AND `time_over` < "'.(time()-120).'" AND `time_over` > "'.(time() - 360).'" AND `time_over` != 0 ORDER BY `battle`.`time_over` DESC LIMIT 1')); if (isset($sp['id'])) { mysql_query('UPDATE `battle` SET `time_over` = `time_over` - 300 WHERE `id` = "'.$sp['id'].'" LIMIT 1'); $sps = mysql_query('SELECT * FROM `users` WHERE `mail` LIKE "haot@new-combats.com" AND `battle` = 0'); while( $pl = mysql_fetch_array($sps)) { if (isset($pl['id'])) { mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "'.$pl['id'].'" LIMIT 1'); mysql_query('DELETE FROM `users` WHERE `id` = "'.$pl['id'].'" LIMIT 1'); mysql_query('DELETE FROM `stats` WHERE `id` = "'.$pl['id'].'" LIMIT 1'); mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100'); mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$pl['id'].'" LIMIT 100'); } } } // $sps = mysql_query('SELECT * FROM `users` WHERE `battle` > 0'); while( $pl = mysql_fetch_array($sps)) { if (isset($pl['id'])) { $test = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$pl['battle'].'" LIMIT 1')); if (($test['time_over'] < (time()-600) && $test['time_over'] !=0) || !isset($test['id'])) { mysql_query('UPDATE `users` SET `battle`= 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); mysql_query('UPDATE `stats` SET `battle_yron` = 0 WHERE `id` = "'.$pl['id'].'" LIMIT 1'); } } } // unset($sp,$sps,$pl,$test); ?>