Файл: public_html/cron_71b682d7a8bf77511d5d66bf3a23275d/startCapture.php
Строк: 21
<?php
$connect = array('localhost', 'cd90484_lasthero', '112233', 'cd90484_lasthero');
$base = $db = new mysqli($connect['0'], $connect['1'], $connect['2'], $connect['3']);
$base -> query("SET NAMES 'UTF8'");
if($base -> connect_errno) die('ERROR -> '.$base -> connect_error);
$bt = $db->query("SELECT * FROM `capture_battles` WHERE `status` = 'prepare' LIMIT 1")->fetch_object();
$tower_health = round($bt->parameters*100);
$players = $db->query("SELECT * FROM `capture_players` WHERE `battle` = '".$bt->id."'")->num_rows;
if($players > 2)
{
$db->query("UPDATE `capture_battles` SET `tower_health` = '".$tower_health."', `endtime` = '".(time()+3600)."', `status` = 'battle' WHERE `id` = '".$bt->id."'");
}
else
{
$db->query("UPDATE `capture_battles` SET `status` = 'end' WHERE `id` = '".$bt->id."'");
}
//запуск каждый день в 17:00