Вход Регистрация
Файл: html/system/func.php
Строк: 287
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/system/connect.php';

/* ВЫХОД ИЗ ИГРЫ */
if (isset($_GET['exit_game'])) {
    
setcookie("login"""time() - 86400 31);
    
setcookie("password"""time() - 86400 31);
    
$user NULL;
}
/* Навигация */
if (isset($user) && $user['game_ban'] > 0) {
    
setcookie("login"""time() - 86400 31);
    
setcookie("password"""time() - 86400 31);
    
?><script>
        /*nextshowcontemt*/showContent('/index.php?msg=' + encodeURIComponent('персонаж заблокирован'));
    </script>
    <?php
    
exit(0);
}
if (isset(
$user)) {
    if (
$user['login'] != $login or $user['password'] != $password) {
        
setcookie('login'''time() - 86400 31);
        
setcookie('password'''time() - 86400 31);
    }
    
$query 'SELECT*FROM users WHERE login="' $login '" AND banned !=1';
    
$ban $mc->query('SELECT COUNT(0),`time`,`msgid` FROM `chatban` WHERE `user` = "' $user['id'] . '"')->fetch_array(MYSQLI_ASSOC);
    if (
$ban['COUNT(0)'] != 0) {
        if (
$ban['time'] <= time()) {
            
$mc->query('DELETE FROM `ban` WHERE `user` = "' $user['id'] . '"');
        }
    }

    
$users $mc->query("SELECT * FROM `users` WHERE `login` = '" $login "' and `password`='" $password "' LIMIT 1")->fetch_assoc();

    if (isset(
$user['id']) && $users['login'] != $login or $users['password'] != $password) {
        
setcookie('login'''time() - 86400 31);
        
setcookie('password'''time() - 86400 31);
    }
}

function 
ico($dir$file) {
    
$img '<img src="/images/' $dir '/' $file '" width="16px" alt="*" />';
    return 
$img;
}

function 
error($sms) {
    
?>
    <script>/*nextshowcontemt*/showContent("/main?0066");</script>
    <?php
    
exit(0);
}

/* Вывод времени */

function noauth() {
    global 
$user;
    if (isset(
$user['id']) && !isset($_GET['exit_game'])) {
        
?>
        <script>/*nextshowcontemt*/showContent("/main.php?136.132423");</script>
        <?php
        
exit(0);
    }
}

function 
auth() {
    global 
$user;
    if (!isset(
$user['id']) && !isset($_GET['exit_game'])) {
        
?>
        <script>/*nextshowcontemt*/showContent("/?002");</script>
        <?php
        
exit(0);
    }
}

function 
requestModer() {
    global 
$request_access;
    if (
$request_access == true) {
        
?>
        <script>/*nextshowcontemt*/showContent("/request_moder.php");</script>
        <?php
        
exit(0);
    }
}

function 
norequestModer() {
    global 
$request_access;
    if (
$request_access == false) {
        
?>
        <script>/*nextshowcontemt*/showContent("/main?003");</script>
        <?php
        
exit(0);
    }
}

function 
access($access 0) {
    global 
$user;
    if (
$user['access'] < $access) {
        
?>
        <script>/*nextshowcontemt*/showContent("/main?005");</script>
        <?php
        
exit(0);
    }
}

if (isset(
$_GET['msg'])) {
    
message($_GET['msg']);
}

function 
message($text) {
    
?>
    <div class="msg" style="opacity: 0;z-index: 99999999;background-color: rgba(0,0,0,0.5);width: 100%;height: 100%;position: fixed;top: 0;left: 0;">
        <table style="margin: auto;width: 240px;height: 100%">
            <tr>
                <td style="vertical-align: middle;text-align: center;">
                    <div style="width:100%;background-color: #FFFFCC;border-color: black;border-style: solid;border-width: 2px;border-radius: 4px;">
                        <br>
                        <div class="text_msg"><?= urldecode($text); ?></div>
                        <br>
                        <div onclick="hideMsg111();" class="button_alt_01" style="margin: auto;" id="bt1t" >Ок</div>
                        <br>
                    </div>
                </td>
            </tr>
        </table>
        <script type='text/javascript'>
            $('.msg:eq(-1)').animate({'opacity': '1'}, 500);
            var control = 0;
            if (typeof (hideMsg111) !== "function") {
                hideMsg111 = function () {
                    if (control === 0) {
                        $('.msg:eq(-1)').animate({'opacity': '0'}, 500);
                        MyLib.setTimeid[200] = setTimeout(function () {
                            control = 1;
                            $('.msg:eq(-1)').remove();
                            $('.msg:eq(-1)').animate({'opacity': '1'}, 500);
                            control = 0;
                        }, 600);
                    }
                };
            }
        </script>
    </div>
    <?php
}

function 
message_yn($text$btny$btnn$namea$nameb) {
    if (isset(
$namea) == "") {
        
$namea "Принять";
    }
    if (isset(
$nameb) == "") {
        
$nameb "Отклонить";
    }
    
?>
    <div class="msg" style="opacity: 0;z-index: 99999999;background-color: rgba(0,0,0,0.5);width: 100%;height: 100%;position: fixed;top: 0;left: 0;">
        <table style="margin: auto;width: 240px;height: 100%">
            <tr>
                <td style="vertical-align: middle;text-align: center;">
                    <div style="width:100%;background-color: #FFFFCC;border-color: black;border-style: solid;border-width: 2px;border-radius: 4px;">
                        <div class="text_msg" style="margin: 10px;"><?= urldecode($text); ?></div>
                        <div class="button_alt_01" onclick="hideMsg222();showContent('<?= urldecode($btny); ?>');" style="margin: auto;margin-bottom: 5px;" ><?= urldecode($namea); ?></div>
                        <div class="button_alt_01" onclick="hideMsg222();showContent('<?= urldecode($btnn); ?>');" style="margin: auto;margin-bottom: 5px;"><?= urldecode($nameb); ?></div>
                    </div>
                </td>
            </tr>
        </table>
        <script type='text/javascript'>
            $('.msg:eq(-1)').animate({'opacity': '1'}, 500);
            if (typeof (hideMsg222) !== "function") {
                var control = 0;
                hideMsg222 = function () {
                    if (control === 0) {
                        $('.msg:eq(-1)').animate({'opacity': '0'}, 500);
                        MyLib.setTimeid[200] = setTimeout(function () {
                            control = 1;
                            console.log(38472378487);
                            $('.msg:eq(-1)').remove();
                            $('.msg:eq(-1)').animate({'opacity': '1'}, 500);
                            control = 0;
                        }, 600);
                    }
                };
            }
        </script>
    </div>
    <?php
}

function 
GetLevel($exp) {
    
$level 0;
    if (
$exp 1000)
        
$level 1;
    if (
$exp 3000)
        
$level 2;
    if (
$exp 6000)
        
$level 3;
    if (
$exp 10000)
        
$level 4;
    if (
$exp 15000)
        
$level 5;
    if (
$exp 21000)
        
$level 6;
    if (
$exp 29000)
        
$level 7;
    if (
$exp 37000)
        
$level 8;
    if (
$exp 46000)
        
$level 9;
    if (
$exp 56000)
        
$level 10;
    if (
$exp 67000)
        
$level 11;
    if (
$exp 97000)
        
$level 12;
    if (
$exp 150000)
        
$level 13;
    return 
$level;
}

//тотемы
function setTotem() {
    
$totemcost = [05001000150020002500300040005000600070008000];
    
//получить параметры пользователя
    
global $user;
    global 
$mc;
    
//проверить на пустоту параметры пользователя
    
if (isset($user)) {
        
//получение инфы клана
        
if ($clan $mc->query("SELECT * FROM `clan` WHERE `id` = '" $user['id_clan'] . "'")->fetch_array(MYSQLI_ASSOC)) {

            
//проверяем содержание тотема в клане
            
if ($clan['gold'] >= ($clan['totemtec'] * 10)) {
                
//получение тотема 12 шт айди от 1085 до 1096
                //если герой глава клана то поставить ему максимальный тотем соответствующий лвлу
                
if ($user['des'] == '3') {
                    
//если уровень героя больше или равно тотему то установить тотем текущий клана
                    
if ($user['level'] - >= $clan['totemtec']) {
                        
totemAdd($clan['totemtec']);
                        
//или установить тотем соответствующий лвлу
                    
} else if ($user['level'] - <= $clan['totemtec']) {
                        
totemAdd($user['level'] - 5);
                    }
                    
//или посчитать тотем для героя в клане по рейтингу
                
} else {
                    for (
$i count($totemcost) - 1$i >= 0$i--) {
                        if (
$user['reit'] >= $totemcost[$i] && $i <= $user['level'] - && $i <= $clan['totemtec']) {
                            
totemAdd($i);
                            break;
                        }
                    }
                }
            } else {
                
//запишем 0 тотем
                
$mc->query("UPDATE `users` SET `totem` = '0' WHERE `users`.`id` = '" $user['id'] . "'");
                
//удалить все тотемы игрока
                
$mc->query("DELETE FROM `userbag` WHERE `id_user` = '" $user['id'] . "' AND `id_shop` > '1084' AND `id_shop` < '1097'");
            }
        } else {
            
//запишем 0 тотем
            
$mc->query("UPDATE `users` SET `totem` = '0' WHERE `users`.`id` = '" $user['id'] . "'");
            
//удалить все тотемы игрока
            
$mc->query("DELETE FROM `userbag` WHERE `id_user` = '" $user['id'] . "' AND `id_shop` > '1084' AND `id_shop` < '1097'");
        }
    }
}

function 
totemAdd($numtotem) {
    global 
$mc;
    
//тотем 12 шт айди от 1085 до 1096
    
$totem = [108510861087108810891090109110921093109410951096109610961096109610961096];
    
//получить параметры пользователя
    
global $user;
    
//проверить на пустоту параметры пользователя
    
if (isset($user)) {
        if (
$numtotem 0) {
            
$numtotem 0;
        }
        
$checkTotem $mc->query("SELECT * FROM `userbag` WHERE `id_user` = '" $user['id'] . "' AND `id_shop` > '1084' AND `id_shop` < '1097'")->num_rows;
        if (
$user['totem'] != $numtotem || $checkTotem == 0) {
            
//удалить все тотемы игрока
            
$mc->query("DELETE FROM `userbag` WHERE `id_user` = '" $user['id'] . "' AND `id_shop` > '1084' AND `id_shop` < '1097'");
            
//получаем параметры нового тотема
            
if ($infoshop1 $mc->query("SELECT * FROM `shop` WHERE `id`='" $totem[$numtotem] . "'")->fetch_array(MYSQLI_ASSOC)) {
                
//запишем новый тотем
                
$mc->query("UPDATE `users` SET `totem` = '$numtotem' WHERE `users`.`id` = '" $user['id'] . "'");
                
//одеваем новый
                
$mc->query("INSERT INTO `userbag`("
                        
"`id_user`,"
                        
" `id_shop`,"
                        
" `id_punct`,"
                        
" `dress`,"
                        
" `iznos`,"
                        
" `time_end`,"
                        
" `koll`,"
                        
" `BattleFlag`"
                        
") VALUES ("
                        
"'" $user['id'] . "',"
                        
"'" $infoshop1['id'] . "',"
                        
"'" $infoshop1['id_punct'] . "',"
                        
"'1',"
                        
"'-1',"
                        
"'0',"
                        
"'-1',"
                        
"'" $infoshop1['BattleFlag'] . "'"
                        
")");
                
//пересчитаем статы
                
?>
                <script>/*nextshowcontemt*/showContent('/main?msg=' + encodeURIComponent('Новый уровень тотема'));</script>
                <?php
                
exit(0);
            }
        }
    }
}

if (isset(
$user)) {
    
$dta time();
    
$ip $_SERVER["REMOTE_ADDR"];
    
$mc->query("UPDATE `users` SET `ip`='" $ip "',`online`='" $dta "' WHERE `id`='" $user["id"] . "'");


    
$profile $mc->query("SELECT * FROM `users` WHERE `id` = '" $user['id'] . "'")->fetch_array(MYSQLI_ASSOC);
    
$arrtablopit $mc->query("SELECT * FROM exp ORDER BY `exp`.`lvl` DESC")->fetch_all(MYSQLI_ASSOC);

    
/*
      health Здоровье
      toch точность
      strength урон
      lov уворот
      kd оглушение
      block блок
      bron

     */
    
for ($i 0$i count($arrtablopit); $i++) {
        If (
$profile['exp'] >= $arrtablopit[$i]['exp'] && $profile['level'] < $arrtablopit[$i]['lvl']) {
            
$mc->query("UPDATE `users` SET "
                    
"`level` = '" $arrtablopit[$i]['lvl'] . "',"
                    
"`slava` = `slava`+'" . ($arrtablopit[$i]['lvl'] * 25) . "',"
                    
"`health` = '" . (10 + ($arrtablopit[$i]['lvl'])) . "',"
                    
"`strength` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "',"
                    
"`toch` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "',"
                    
"`bron` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "',"
                    
"`lov` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "',"
                    
"`kd` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "',"
                    
"`block` = '" . (+ ($arrtablopit[$i]['lvl']) - 2) . "'"
                    
" WHERE `users`.`id` = '" $user['id'] . "'");
            if (
$arrtablopit[$i]['lvl'] >= 10) {
                
$chatmsg "<font color=\'#0033cc\'>" $profile['name'] . " достиг " $arrtablopit[$i]['lvl'] . " уровня!</font>";
                
$mc->query("INSERT INTO `chat`(`id`,`name`,`id_user`,`chat_room`,`msg`,`msg2`,`time`, `unix_time`) VALUES (NULL,'Лвл ап','','0', '" $chatmsg "','','','' )");
                
$mc->query("INSERT INTO `chat`(`id`,`name`,`id_user`,`chat_room`,`msg`,`msg2`,`time`, `unix_time`) VALUES (NULL,'Лвл ап','','1', '" $chatmsg "','','','' )");
            }

            
//проверяем ссылку реф
            
$ref $profile['ref'];
            if (
$ref 0) {
                
//если герой есть с таким номером реф
                
if ($mc->query("SELECT * FROM `users` WHERE `myref` = '$ref'")->num_rows 0) {
                    
//здесь пропишем реф бонусы
                    
$ref_exp 0;
                    
$ref_slava 0;
                    
$ref_clan_reit 0;
                    
$ref_platinum 0;
                    
//бонусы игроку
                    
$bon_money 0;
                    
$bon_platina 0;
                    if (
$arrtablopit[$i]['lvl'] == 5) {
                        
$ref_exp += 1;
                        
$ref_slava += 1;
                        
$ref_platinum += 1;
                        
$bon_money 100000;
                        
//запишем зарегистрированному 10золота и сообщение
                        
$mc->query("UPDATE `users` SET `money` = `money`+'100000' WHERE `id` = '" $user['id'] . "' ");
                        
$mc->query("INSERT INTO `msg` (`id_user`,`message`,`date`,`type`) VALUES ('" $user['id'] . "','Вы получили 10<img class="ico_head_all" src="/images/icons/zoloto.png">. От пригласившего вас игрока.','" time() . "','ref')");
                    } else if (
$arrtablopit[$i]['lvl'] == 10) {
                        
$ref_exp += 1;
                        
$ref_slava += 1;
                        
$ref_platinum += 10;
                        
$bon_money 200000;
                        
//запишем зарегистрированному 20золота и сообщение
                        
$mc->query("UPDATE `users` SET `money` = `money`+'200000' WHERE `id` = '" $user['id'] . "' ");
                        
$mc->query("INSERT INTO `msg` (`id_user`,`message`,`date`,`type`) VALUES ('" $user['id'] . "','Вы получили 20<img class="ico_head_all" src="/images/icons/zoloto.png">. От пригласившего вас игрока.','" time() . "','ref')");
                    } else if (
$arrtablopit[$i]['lvl'] == 15) {
                        
$ref_exp += 1;
                        
$ref_slava += 1;
                        
$ref_platinum += 25;
                        
$bon_money 40;
                        
$bon_platina 5;
                        
//запишем зарегистрированному 40золота 5платин и сообщение
                        
$mc->query("UPDATE `users` SET `money` = `money`+'400000',`platinum` = `platinum`+'5' WHERE `id` = '" $user['id'] . "' ");
                        
$mc->query("INSERT INTO `msg` (`id_user`,`message`,`date`,`type`) VALUES ('" $user['id'] . "','Вы получили 40<img class="ico_head_all" src="/images/icons/zoloto.png"> 5<img class="ico_head_all" src="/images/icons/plata.png">. От пригласившего вас игрока.','" time() . "','ref')");
                    } else if (
$arrtablopit[$i]['lvl'] > 1) {
                        
$ref_exp += 1;
                        
$ref_slava += 1;
                    }

                    
//а пригласившему 1 славы и 1 опыта в ref_bonus
                    
if ($mc->query("SELECT * FROM `ref_bonus` WHERE `ref_num` = '$ref'")->num_rows 0) {
                        
//обновить
                        
$mc->query("UPDATE `ref_bonus` SET "
                                
"`exp`=`exp`+'$ref_exp',"
                                
"`slava`=`slava`+'$ref_slava',"
                                
"`clan_reit`=`clan_reit`+'$ref_clan_reit',"
                                
"`platinum`=`platinum`+'$ref_platinum'"
                                
"WHERE `ref_num` = '$ref'");
                    } else {
                        
//или создать если записи бонусов нет
                        
$mc->query("INSERT INTO `ref_bonus` ("
                                
"`id`,"
                                
" `ref_num`,"
                                
" `exp`,"
                                
" `slava`,"
                                
" `clan_reit`,"
                                
" `platinum`"
                                
") VALUES ("
                                
"NULL,"
                                
" '$ref',"
                                
" '$ref_exp',"
                                
" '$ref_slava',"
                                
" '$ref_clan_reit',"
                                
" '$ref_platinum'"
                                
")");
                    }
                }
            }
            
?><script>/*nextshowcontemt*/showContent('/newlevel.php');</script><?php
            
exit(0);
        }
    }
//сброс Према после окончания срока
    
if ($user['prem'] > 0) {
        if (
$user['prem_t'] <= time()) {
            
$mc->query("UPDATE `users` SET `prem` = '0',`prem_t` = '0' WHERE `id` = '" $user['id'] . "'");
        }
    }
    if (
$mc->query("SELECT * FROM `userbag` WHERE `id_user` = '" $user['id'] . "' AND `dress` = '1' AND `id_punct` < 9 AND `iznos` = '0'")->num_rows 0) {
        
$mc->query("UPDATE `userbag` SET `dress` = '0' WHERE `id_user` = '" $user['id'] . "' AND `id_punct` < 9 AND `iznos` = '0'");
        
?><script>/*nextshowcontemt*/showContent('/main.php?msg=Ваши вещи в ужасном состоянии');</script><?php
        
exit(0);
    }
}
//проверка побед монстров, поражений и побед игроков ,если меньше 0 выдать штраф и обнулить
//мобы победа

/* if($user['pobedmonser'] < 0){
  if($mc->query("UPDATE `users` SET `pobedmonser` = '0' WHERE `id` = '".$user['id']."'")){
  message("Победы Монстров бвли обнулены а также вы получили <b> Штрафные санкции</b>");
  //shop_buy(1672, 'y');
  }
  }
  //мобы поражения
  if($user['losemonser'] < 0){
  if($mc->query("UPDATE `users` SET `losemonser` = '0' WHERE `id` = '".$user['id']."'")){
  message("Поражения Монстров были обнулены а также вы получили <b> Штрафные санкции</b>");
  //shop_buy(1672, 'y');
  }
  }
  //игроки
  if($user['pobedigroki'] < 0){
  //require_once $_SERVER['DOCUMENT_ROOT'] . '/functions/wesh_kupit.php';
  //require_once $_SERVER['DOCUMENT_ROOT'] . '/functions/wesh_kupit.php';
  if($mc->query("UPDATE `users` SET `pobedigroki` = '0' WHERE `id` = '".$user['id']."'")){
  message("Победы игроков были обнулены а также вы получили <b> Штрафные санкции</b>");
  //shop_buy(1672, 'y');
  }
  } */
?>
Онлайн: 0
Реклама