124 lines
4.7 KiB
PHP
124 lines
4.7 KiB
PHP
<?php
|
||
session_start();
|
||
if (!$_SESSION['uid']) {
|
||
header("Location: index.php");
|
||
exit;
|
||
}
|
||
require_once "functions.php";
|
||
$user = $user ?? [];
|
||
if ($user->room != 401) {
|
||
header("Location: main.php");
|
||
exit;
|
||
}
|
||
if ($user->battle) {
|
||
header('Location: fbattle.php');
|
||
exit;
|
||
}
|
||
|
||
class hellround
|
||
{
|
||
|
||
// проверяет участие в турнире, возвращает айди похода
|
||
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;"));
|
||
}
|
||
|
||
// увеличить волну
|
||
function inc_volna($id)
|
||
{
|
||
mysql_query("UPDATE `hellround_pohod` SET `volna`=`volna`+1 WHERE `id` = " . $id . " LIMIT 1;");
|
||
}
|
||
}
|
||
|
||
$hr = new hellround;
|
||
|
||
$mytrip = $hr->is_in_trip($user['id']);
|
||
$tr = $hr->get_par($mytrip);
|
||
\Battles\Template::header('hell');
|
||
if ($mytrip > 0) {
|
||
|
||
?>
|
||
<style>
|
||
body {
|
||
background-image: url('i/hell.jpg');
|
||
background-repeat: no-repeat;
|
||
background-position: top right;
|
||
}
|
||
</style>
|
||
<?php
|
||
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 сутки.';
|
||
} else {
|
||
// начиаем поход!!! за родину!!!! на черта!!! в жопу чертей!!!
|
||
mysql_query("INSERT `hellround_pohod` (`owner`) VALUES ('" . $user['id'] . "');");
|
||
header("Location:hell.php");
|
||
}
|
||
}
|
||
|
||
?>
|
||
<style>
|
||
|
||
body {
|
||
background-image: url('i/hell.jpg');
|
||
background-repeat: no-repeat;
|
||
background-position: top right;
|
||
}
|
||
</style>
|
||
<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">
|
||
</td>
|
||
<td align=right>
|
||
<INPUT TYPE="button" onclick="location.href = 'city.php?bps=1';" value="Вернуться" name="strah">
|
||
</table>
|
||
</form>
|
||
<FORM method=POST>
|
||
<h3>Врата Ада</h3>
|
||
<center><font color=red><B><?= $err ?></B></font><BR>
|
||
<i>Отродья хаоса лезут отовсюду... Наплывы слуг хаоса не прекращаються не на минуту! Окажи посильную помощь
|
||
в войне с Хаосом! Будь доблестен сердцем и душей!</i></center>
|
||
<BR>
|
||
<center>
|
||
<fieldset style="width:50%;">
|
||
<legend>
|
||
Общий ТОП
|
||
</legend>
|
||
</center>
|
||
<?
|
||
$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>";
|
||
}
|
||
?>
|
||
<center>
|
||
</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>";
|
||
?>
|
||
|
||
</fieldset>
|
||
</center>
|
||
</FORM>
|
||
<?
|
||
}
|