2018-01-28 16:40:49 +00:00
< ? php
2021-02-01 14:39:48 +00:00
use Battles\Template ;
2020-09-29 22:39:06 +00:00
session_start ();
require_once " functions.php " ;
2021-02-01 14:39:48 +00:00
2020-09-29 22:39:06 +00:00
class hellround
{
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
// проверяет участие в турнире, возвращает айди похода
function is_in_trip ( $id )
{
$f = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `hellround_pohod` WHERE `end` = 0 AND `owner`= " . $id . " LIMIT 1; " ));
return $f [ 0 ];
}
// возвращает параметры похода
function get_par ( $id )
{
return mysql_fetch_array ( mysql_query ( " SELECT * FROM `hellround_pohod` WHERE `id` = " . $id . " LIMIT 1; " ));
}
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
// увеличить волну
function inc_volna ( $id )
{
mysql_query ( " UPDATE `hellround_pohod` SET `volna`=`volna`+1 WHERE `id` = " . $id . " LIMIT 1; " );
}
}
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
$hr = new hellround ;
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
$mytrip = $hr -> is_in_trip ( $user [ 'id' ]);
$tr = $hr -> get_par ( $mytrip );
2021-02-01 14:39:48 +00:00
Template :: header ( 'hell' );
2020-09-29 22:39:06 +00:00
if ( $mytrip > 0 ) {
2020-09-30 19:12:34 +00:00
2020-09-29 22:39:06 +00:00
?>
2020-09-30 19:12:34 +00:00
< style >
body {
background - image : url ( 'i/hell.jpg' );
background - repeat : no - repeat ;
background - position : top right ;
}
</ style >
< ? php
2020-09-29 22:39:06 +00:00
echo " <h3>Приближается <i> " . ( $tr [ 'volna' ] + 1 ) . " </i> волна нашествия...</h3> " ;
// диалоговый бот
} else {
if ( $_GET [ 'start' ] > 0 ) {
$f = mysql_fetch_array ( mysql_query ( " SELECT `date_out` FROM `hellround_pohod` WHERE `owner`= " . $user [ 'id' ] . " ORDER by `id` DESC LIMIT 1; " ));
if (( time () - strtotime ( $f [ 'date_out' ])) < 3600 * 24 ) {
$err = 'Сегодня вы уже ходили в поход, интервал между походами 1 сутки.' ;
2018-01-28 16:40:49 +00:00
} else {
2020-09-29 22:39:06 +00:00
// начиаем поход!!! за родину!!!! на черта!!! в жопу чертей!!!
mysql_query ( " INSERT `hellround_pohod` (`owner`) VALUES (' " . $user [ 'id' ] . " '); " );
2018-01-28 16:40:49 +00:00
header ( " Location:hell.php " );
}
}
2020-09-29 22:39:06 +00:00
?>
2020-09-30 19:12:34 +00:00
< style >
2018-01-28 16:40:49 +00:00
2020-09-30 19:12:34 +00:00
body {
background - image : url ( 'i/hell.jpg' );
background - repeat : no - repeat ;
background - position : top right ;
}
</ style >
2020-09-29 22:39:06 +00:00
< TABLE border = 0 width = 100 % cellspacing = " 0 " cellpadding = " 0 " >
< td align = left >
< INPUT TYPE = " button " onclick = " location.href = 'hell.php?start=1'; " value = " НАЧАТЬ ПОХОД " name = " strah " >
2021-02-01 14:39:48 +00:00
2020-09-29 22:39:06 +00:00
< td align = right >
< INPUT TYPE = " button " onclick = " location.href = 'city.php?bps=1'; " value = " Вернуться " name = " strah " >
</ table >
< FORM method = POST >
< h3 > Врата Ада </ h3 >
2021-02-01 14:39:48 +00:00
< div style = " text-align: center; color: #f80000; font-weight: bold; " >< ? = $err ?> </div>
< i > Отродья х а о с а лезут отовсюду ... Наплывы слуг х а о с а не прекращаються не на минуту ! Окажи посильную помощь
в войне с Хаосом ! Будь доблестен сердцем и душей !</ i >
2020-09-29 22:39:06 +00:00
< BR >
2021-02-01 14:39:48 +00:00
< div style = " text-align: center; " >
2020-09-29 22:39:06 +00:00
< fieldset style = " width:50%; " >
< legend >
Общий ТОП
</ legend >
2021-02-01 14:39:48 +00:00
2020-09-29 22:39:06 +00:00
< ?
$select = mysql_query ( " SELECT DISTINCT `owner` FROM `hellround_pohod` ORDER by (SELECT SUM(`volna`) FROM `hellround_pohod` WHERE `owner` = `owner`) DESC LIMIT 10; " );
while ( $f = mysql_fetch_array ( $select )) {
$i ++ ;
echo " " . $i . " . " . Nick :: id ( $f [ 0 ]) -> full ( 1 ) . " <BR> " ;
}
?>
2021-02-01 14:39:48 +00:00
2020-09-29 22:39:06 +00:00
</ fieldset >
< fieldset style = " width:50%; " >
< legend > Личный ТОП </ legend >
< ?
$select = mysql_fetch_array ( mysql_query ( " SELECT count(`id`) FROM `hellround_pohod` WHERE `owner` = " . $user [ 'id' ] . " ; " ));
echo " В с е г о походов: <B>" . $select [ 0 ] . " </B>.<BR> " ;
$select = mysql_fetch_array ( mysql_query ( " SELECT * FROM `hellround_pohod` WHERE `owner` = " . $user [ 'id' ] . " ORDER by `volna` DESC LIMIT 1; " ));
echo " Максимально продержался <B> " . $select [ 'volna' ] . " </B> волн.<BR> " ;
$select = mysql_fetch_array ( mysql_query ( " SELECT `date_out`,`date_in` FROM `hellround_pohod` WHERE `owner` = " . $user [ 'id' ] . " ORDER by `date_out`-`date_in` DESC LIMIT 1; " ));
echo " Максимально продержался времени: <span class=date> " . date ( " H:i:s " , - 10800 + strtotime ( $select [ 0 ]) - strtotime ( $select [ 1 ])) . " </span>.<BR> " ;
?>
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
</ fieldset >
2021-02-01 14:39:48 +00:00
</ div >
2020-09-29 22:39:06 +00:00
</ FORM >
< ?
2020-09-30 19:12:34 +00:00
}