Вход Регистрация
Файл: public_html/modules/battleground/index.php
Строк: 82
<?php
$root 
$_SERVER['DOCUMENT_ROOT'];
include_once (
$root.'/core/base.php');
falseauth();
$header "Поле боя";
include_once (
$root.'/core/head.php');
error_reporting(2047);
if(
$u['battleground_id'] != 0) {
    
$btl $db->query("SELECT * FROM `battleground_battles` WHERE `id` = '" $u['battleground_id'] . "'")->fetch_object();
    
$players $db->query("SELECT * FROM `battleground_players` WHERE `battle` = '" $u['battleground_id'] . "'")->num_rows;
    if (
$players == && $btl->status != 'battle') {
        
$db->query("UPDATE `battleground_battles` SET `status` = 'battle', `starttime` = '" time() . "'");
    }
    if (
$btl->status == 'battle'redirect("/battleground/battle");
    if (
$btl->status == 'result'redirect('/battleground/result');
    if (
$btl->status == 'end')
    {
        
$db->query("UPDATE `users` SET `battleground_id` = '0' WHERE `id` = '" $u['id'] . "'");
        
redirect('/battleground');
    }
}
if(
$u['battleground_result'] != '0')
{
    echo 
'<div class="b">'.$u['battleground_result'].'</div>';
    
$db->query("UPDATE `users` SET `battleground_result` = '0' WHERE `id` = '".$u['id']."'");
}
if(
$u['battleground_rating'] >= $max_rating)
{
    
$league $db->query("SELECT * FROM `battleground_leagues` WHERE `id` >= '10' LIMIT 1")->fetch_object();
}
else
{
    
$league $db->query("SELECT * FROM `battleground_leagues` WHERE `min_rating` >= '".$u['battleground_rating']."' LIMIT 1")->fetch_object();
}
if(isset(
$_GET['enter']))
{
    if(
$u['battleground_id'] != 0redirect("/battleground""Вы уже в очереди!");
    
$issetBattles $db->query("SELECT * FROM `battleground_battles` WHERE `status` = 'prepare'ORDER BY RAND() LIMIT 1");
    if(
$issetBattles->num_rows 0)
    {
        
$iB $issetBattles->fetch_object();
        
$db->query("INSERT INTO `battleground_players` (battle, user, health, opponent) VALUES ('".$iB->id."', '".$u['id']."', '".get_max_health($u['id'])."', '0')");
        
$db->query("UPDATE `users` SET `battleground_id` = '".$iB->id."' WHERE `id` = '".$u['id']."'");
    }
    else
    {
        
$db->query("INSERT INTO `battleground_battles` (`status`) VALUES ('prepare')");
        
$idBtl $db->insert_id;
        
$db->query("INSERT INTO `battleground_players` (battle, user, health, opponent) VALUES ('".$idBtl."', '".$u['id']."', '".get_max_health($u['id'])."', '0')");
        
$db->query("UPDATE `users` SET `battleground_id` = '".$idBtl."' WHERE `id` = '".$u['id']."'");
    }
    
redirect("/battleground""Вы встали в очередь!");
}
if(isset(
$_GET['leave']))
{
    if(
$u['battleground_id'] == 0redirect("/battleground""Вы не в очереди!");
    if(
$players == 1)
    {
        
$db->query("DELETE FROM `battleground_battles` WHERE `id` = '".$u['battleground_id']."'");
    }
    
$db->query("DELETE FROM `battleground_players` WHERE `battle` = '".$u['battleground_id']."' AND `user` = '".$u['id']."'");
    
$db->query("UPDATE `users` SET `battleground_id` = '0' WHERE `id` = '".$u['id']."'");
    
redirect("/battleground"'Вы покинули очередь!');
}
echo
'<div class = "notice_container">
<div class = "gborder notice_alert alert-success">
Поле боя
</div></div></center>'
;
echo 

    <div class="b"> 
        <table width="100%"> 
            <tr> 
                <td width="55px" valign="top"> 
                    <img width="60px" src="/images/leagues/'
.$league->image_id.'.png">
                </td> 
                <td valign="top"> 
                    <big> <font color = "white">  '
.$league->name.'</font></big> 
                    <div class="txt"> 
                        Текущий рейтинг: '
.$u['battleground_rating'].'</br>';
                        if(
$u['battleground_id'] == 0){
                            echo
"Примите участие";
                        }else{
                        echo
'Игроков в очереди: '.$players.'<br>';
                          echo 
'<a href="?" class = "btn _green">Обновить</a>';
                        }
                    echo
'</div> 
                </td> 
            </tr> 
        </table> 
    '

if(
$u['battleground_id'] == 0)
{
    echo 
'<center><a href="/battleground/enter"><input type="submit" value="Принять участие"></a></center>';
}
else
{
    echo 
'<center><a href="/battleground/leave"><input type="submit" value="Отказаться от участия"></a></center>';
}
echo
"</div>";
include_once (
$root.'/core/foot.php');
Онлайн: 2
Реклама