Файл: public_html/modules/demons/index.php
Строк: 127
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once ($root.'/core/base.php');
falseauth();
$header = "Вторжение демонов";
include_once ($root.'/core/head.php');
?>
<style>
.example3 {
display: inline-block;
position: relative;
width: 100%;
}
.clickers {
display: block;
text-decoration: none;
min-height: 17px;
width: 183px;
padding: 15px 8px;
position: relative;
z-index: 100;
text-align: center;
font-size: 24px;
color: #fff;
border-radius: 3px;
border: 1px solid #000;
background: linear-gradient(to bottom,#6bb646 3%,#277a00 4%,#1d5d00 96%,#103400 97%);
background-color: #1c5b00;
}
.index-demons {
padding-top: 420px;
background: #343434 url(/images/demons-main.png) top center no-repeat;
display: block;
height: auto;
margin: 0;
}
.example3 .examples_text {
display: block;
position: absolute;
font-size: 50px;
left: 0;
bottom: -30px;
width: 100%;
height: 98%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #fff;
padding: 0px;
}
.example3 .examples_text-1 {
display: block;
position: absolute;
font-size: 20px;
left: 0;
bottom: 0px;
width: 100%;
height: 80%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #fff;
padding: 0px;
}
.example3 .examples_text-0 {
display: block;
position: absolute;
font-size: 21px;
left: 0;
bottom: 0px;
width: 100%;
height: 54%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #fff;
/* padding: 0px; */
}
.example3 .examples_text-9 {
display: block;
position: absolute;
font-size: 30px;
left: 0;
bottom: 0px;
width: 100%;
height: 54%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #fff;
/* padding: 0px; */
}
.example3 .examples_text-2 {
display: block;
position: absolute;
font-size: 16px;
left: 0;
bottom: 0px;
height: 29%;
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #fff;
padding: 0px;
background-color: rgba(0,0,-16,0.3);
}
</style>
<?
$btlPrepared = $db->query("SELECT * FROM `demons_battles` WHERE `status` = 'prepare' ORDER BY RAND() LIMIT 1");
$btlBattled = $db->query("SELECT * FROM `demons_battles` WHERE `status` = 'battle'");
$btlResulted = $db->query("SELECT * FROM `demons_battles` WHERE `status` IN ('result-win', 'result-lose-boss', 'result-lose-mobs')");
echo '<div class="example3">
<div class="index-demons">
<div class="examples_text"><center>Вторжение</center></div>';
if($btlPrepared == 0 && $btlBattled == 0 && $btlResulted == 0)
{
if((int)date("H",time()) >= 0 && (int)date("H",time()) < 6) $btlTime = mktime(6,0,0);
elseif((int)date("H",time()) >= 6 && (int)date("H",time()) < 12) $btlTime = mktime(12,0,0);
elseif((int)date("H",time()) >= 12 && (int)date("H",time()) < 18) $btlTime = mktime(18,0,0);
else $btlTime = mktime(0,0,0)+86400;
echo '<div class="examples_text-1"><center>До начала '.tl($btlTime-time()).'</center></div>';
}
if($btlPrepared->num_rows > 0)
{
$btl = $btlPrepared->fetch_object();
echo '<div class="examples_text-1"><center>До начала '.(($btl->starttime-time() <= 0) ? '0 c.' : tl($btl->starttime-time())).'</center></div>';
$myPlayer = $db->query("SELECT * FROM `demons_players` WHERE `user` = '".$u['id']."' AND `battle` = '".$btl->id."'")->num_rows;
$players = $db->query("SELECT * FROM `demons_players` WHERE `battle` = '".$btl->id."'")->num_rows;
if(isset($_GET['enter']))
{
if($myPlayer > 0) redirect('/demons', 'Вы уже записаны');
$db->query("INSERT INTO `demons_players` (`battle`,`user`,`health`,`damage`) VALUES ('".$btl->id."', '".$u['id']."', '".get_health($u['id'])."', '0')");
redirect('/demons', 'Вы записались!');
}
if($myPlayer == 0)
{
echo '<div class="examples_text-0"><center><a class = "clickers " href = "?enter">Заявка в бой</a></center></div>';
}
else
{
echo '<div class="examples_text-0"><center>Игроков записано: '.$players.'</center></div>';
}
}
elseif($btlPrepared->num_rows == 0 && $btlBattled->num_rows > 0)
{
$btl = $btlBattled->fetch_object();
$myPlayer = $db->query("SELECT * FROM `demons_players` WHERE `user` = '".$u['id']."' AND `battle` = '".$btl->id."'")->num_rows;
if($myPlayer > 0) redirect('/demons/'.$btl->stage);
echo '<div class="examples_text-9"><center>Бой уже идёт</center></div>';
}
elseif($btlResulted->num_rows > 0)
{
$btl = $btlResulted->fetch_object();
$myPlayer = $db->query("SELECT * FROM `demons_players` WHERE `user` = '".$u['id']."' AND `battle` = '".$btl->id."'")->num_rows;
if($myPlayer > 0) redirect('/demons/result');
echo '<div class="examples_text-0"><center>>Идёт подсчёт результатов!</center></div>';
}
echo '<div class="examples_text-2"><center></br>Бои проходят каждые 6 часов</br>
В начале вам предстоит битва против помощников демона </br>
Следующая стадия - это битва против самого демона.</br>
После битвы с демоном игроки сражаются друг с другом.</br>
</center></div>
</div>
</div>';
$lastBattle = $db->query("SELECT * FROM `demons_battles` WHERE `status` IN ('end-win','end-mobs','end-boss')")->num_rows;
if($lastBattle > 0)
{
echo '<div class="line"></div>';
echo '<a class="link" href="/demons/last">Результаты последней битвы</a>';
}
echo '<div class="line"></div>';
include_once ($root.'/core/foot.php');