game/cron/battle_dell.php

33 lines
1.3 KiB
PHP
Raw Blame History

<?php
const GAME = true;
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
//11. ÷èñòêà è ñáðîñ ñ÷åò÷èêîâ ïðè îòñóòñòâèè áîåâ ÷òîá íå ëàìàëñß ëîã
$test = 0;
while ($test == 0) {
$tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win`=-1 ORDER BY `id` LIMIT 1'));
echo "<EFBFBD>îé: ";
echo $tbtl['id'] . "<br>";
if (isset($tbtl['id'])) {
sleep(2);
} else {
mysql_query('UPDATE `users` SET `battle` = 0 WHERE `battle` > 0');
mysql_query(
'LOCK TABLES `battle_act` WRITE,`battle_end` WRITE,`battle_last` WRITE,`battle_out` WRITE,`battle_stat` WRITE,`battle_users` WRITE,`battle` WRITE,`battle_logs` WRITE,`battle_logs_save` WRITE,`zayvki` WRITE'
);
mysql_query('TRUNCATE TABLE `battle_act`');
mysql_query('TRUNCATE TABLE `battle_end`');
mysql_query('TRUNCATE TABLE `battle_last`');
mysql_query('TRUNCATE TABLE `battle_out`');
mysql_query('TRUNCATE TABLE `battle_stat`');
mysql_query('TRUNCATE TABLE `battle_users`');
mysql_query('TRUNCATE TABLE `battle`');
mysql_query('TRUNCATE TABLE `battle_logs`');
mysql_query('TRUNCATE TABLE `battle_logs_save`');
mysql_query('TRUNCATE TABLE `zayvki`');
mysql_query('UNLOCK TABLES');
$test = 1;
}
}