2018-01-28 16:40:49 +00:00
< ? php
2021-08-26 14:44:14 +00:00
use Battles\GameLogs ;
use Battles\Nick ;
$us = mysql_fetch_array ( mysql_query ( " SELECT *, (SELECT `id` FROM `online` WHERE `date` >= " . ( time () - 60 ) . " AND `id` = `users`.`id`) AS `online` FROM `users` WHERE `login` = ' " . mysql_real_escape_string ( $_POST [ 'target' ]) . " ' LIMIT 1 " ));
2018-01-28 16:40:49 +00:00
$vip = mysql_fetch_array ( mysql_query ( 'SELECT `id`, `uid`, `openbattle` FROM `abils_user` WHERE `uid` = "' . $user [ 'id' ] . '" LIMIT 1' ));
$battle = mysql_fetch_array ( mysql_query ( 'SELECT `id`, `open`, `close` FROM `battle` WHERE `id` = "' . $user [ 'battle' ] . '" LIMIT 1' ));
if ( $user [ 'battle' ] <= 0 ) {
echo 'Это боевая магия ...' ;
} elseif ( $battle [ 'open' ] == 1 ) {
echo 'Бой и так открыт ...' ;
} elseif ( $battle [ 'close' ] == 1 ) {
echo 'Этот бой нельзя открыть ...' ;
} elseif ( $vip [ 'openbattle' ] <= 0 ) {
echo 'Магия исчерпала себя ...' ;
} else {
$vip [ 'openbattle' ] -= 1 ;
2020-08-27 12:17:02 +00:00
if ( $user [ 'invis' ] == 1 ) { $lod = '<i><b>невидимка</b></i>' ; } else { $lod = Nick :: id ( $user [ 'id' ]) -> short (); }
2021-08-26 14:44:14 +00:00
GameLogs :: addBattleLog ( $battle [ 'id' ], '<span class=date>' . date ( " H:i " ) . '</span> ' . $lod . ' открыл поединок для внешних вмешательств!<BR>' );
2018-01-28 16:40:49 +00:00
mysql_query ( 'UPDATE `battle` SET `open` = 1 WHERE `id` = "' . $battle [ 'id' ] . '" LIMIT 1' );
mysql_query ( 'UPDATE `abils_user` SET `openbattle` = "' . $vip [ 'openbattle' ] . '" WHERE `id` = "' . $vip [ 'id' ] . '" LIMIT 1' );
echo 'Ваш поединок, открыт...' ;
}