game/cron/clear.php

151 lines
7.8 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');
2023-08-07 10:52:16 +00:00
if (isset($_GET['actions'])) {
//
$data = [];
//
$sp = mysql_query('SELECT * FROM `actions`');
while ($pl = mysql_fetch_array($sp)) {
$pl['vars'] = str_replace(0, '%', $pl['vars']);
$pl['vars'] = str_replace(1, '%', $pl['vars']);
$pl['vars'] = str_replace(2, '%', $pl['vars']);
$pl['vars'] = str_replace(3, '%', $pl['vars']);
$pl['vars'] = str_replace(4, '%', $pl['vars']);
$pl['vars'] = str_replace(5, '%', $pl['vars']);
$pl['vars'] = str_replace(6, '%', $pl['vars']);
$pl['vars'] = str_replace(7, '%', $pl['vars']);
$pl['vars'] = str_replace(8, '%', $pl['vars']);
$pl['vars'] = str_replace(9, '%', $pl['vars']);
$data[$pl['vars']]++;
}
//
print_r($data);
//
die();
2022-06-06 21:30:34 +00:00
}
/*
2023-01-10 16:29:32 +00:00
CRON Очистки сервера от ненужной информации
Действия:
1. Очистка чата
2. Очистка заявок в поединки
3. Очистка заявок в пещеры
4. Очистка походов
2022-06-06 21:30:34 +00:00
*/
2023-01-10 16:29:32 +00:00
// ЕБИИИИИИИЧЕСКАЯ СИИИИЛА!!!!! (с) Инс.
// forign_keys! Никто не знает про foreign_keys!
2023-08-07 10:52:16 +00:00
function delete_user_all($uid, $login)
{
mysql_query('DELETE FROM `aaa_znahar` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `add_smiles` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `a_com_act` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `bandit` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `bank_alh` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $uid . '" OR `uid2` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_actions` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_last` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_stat` WHERE `uid1` = "' . $uid . '" OR `uid2` = "' . $uid . '"');
mysql_query('DELETE FROM `battle_users` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `bs_actions` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `bs_zv` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `building` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `buy_ekr` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `complects_priem` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `dialog_act` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `dump` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `dungeon_actions` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `ekr_sale` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `feerverks` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `fontan` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `fontan_hp` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `fontan_text` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `friends` WHERE `user` = "' . $uid . '"
OR `friend` = "' . $uid . '"
OR `enemy` = "' . $uid . '"
OR `notinlist` = "' . $uid . '"
OR `ignor` = "' . $uid . '"
OR `login_ignor` = "' . $login . '"
OR `user_ignor` = "' . $login . '"');
mysql_query('DELETE FROM `house` WHERE `owner` = "' . $uid . '"');
mysql_query('DELETE FROM `items_img` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `izlom_rating` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `laba_act` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `laba_itm` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `lastnames` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `logs_auth` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `loto_win` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `mults` WHERE `uid` = "' . $uid . '" OR `uid2` = "' . $uid . '"');
mysql_query('DELETE FROM `notepad` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $uid . '" OR `login` = "' . $login . '"');
mysql_query('DELETE FROM `online` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `pirogi` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `reimage` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `rep` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `repass` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `ruletka_coin` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `save_com` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `stats` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `transfers` WHERE `uid1` = "' . $uid . '" OR `uid2` = "' . $uid . '"');
mysql_query('DELETE FROM `users` WHERE `id` = "' . $uid . '"');
mysql_query('DELETE FROM `stats` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_animal` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_gifts` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_reputation` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_turnirs` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `users_twink` WHERE `uid` = "' . $uid . '"');
mysql_query('DELETE FROM `zayavki` WHERE `creator` = "' . $uid . '"');
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
//1. Очистка чата, остается чат только за последние 3 дня
2023-08-07 10:52:16 +00:00
mysql_query('DELETE FROM `chat` WHERE `time` < ' . (time() - 86400 * 3) . '');
2022-06-06 21:30:34 +00:00
2023-01-10 16:29:32 +00:00
//2. Очистка заявок в поединки
2023-08-07 10:52:16 +00:00
mysql_query('DELETE FROM `zayvki` WHERE `start` > 0 OR `cancel` > 0 OR `time` < "' . (time() - 86400 * 1) . '"');
2022-06-06 21:30:34 +00:00
2023-01-10 16:29:32 +00:00
//3. Очистка заявок в пещеры
2023-08-07 10:52:16 +00:00
mysql_query('DELETE FROM `dungeon_zv` WHERE `delete` > 0 OR `time` < "' . (time() - 86400 * 1) . '"');
2022-06-06 21:30:34 +00:00
2023-01-10 16:29:32 +00:00
//4. Очистка походов
2023-08-07 10:52:16 +00:00
$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'] . '"');
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
//5. Очистка монстров
2022-06-06 21:30:34 +00:00
$i = 0;
$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 0 ORDER BY `id` ASC LIMIT 100');
2023-08-07 10:52:16 +00:00
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'])) {
//Очищаем бота
clearUsersFromDb($pl['id'], $pl['login']);
$i++;
}
2022-06-06 21:30:34 +00:00
}
$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');
2023-01-10 16:29:32 +00:00
//6. Очистка личного дела
2023-08-07 10:52:16 +00:00
mysql_query('DELETE FROM `users_delo` WHERE `time` < "' . (time() - 86400 * 30) . '" LIMIT 1000');
2022-06-06 21:30:34 +00:00