Вход Регистрация
Файл: html/shop.php
Строк: 1130
<?php
require_once 'system/func.php';
require_once 
'system/dbc.php';
require_once 
'system/header.php';
require_once 
$_SERVER['DOCUMENT_ROOT'] . '/functions/wesh_snyat.php';
require_once 
$_SERVER['DOCUMENT_ROOT'] . '/functions/wesh_kupit.php';
auth(); // Закроем от неавторизированых

$locatquest $user['location'];

if (isset(
$_GET['msg_prem'])) {
    
message_yn(
    
urlencode('Вы точно желаете активировать премиум? <br> Это обойдется Вам в 200<img style="width: 15px;" src="/images/icons/plata.png">!'),
            
'/shop.php?prem''/shop.php''Да''Отмена'
    
);
}

if (isset(
$_GET['prem'])) {
    if (
$user['prem'] < 1) {
        if (
$user['platinum'] >= 200) {
            
$tim strtotime("+30 day"time());
            if (
$mc->query("UPDATE `users` SET `platinum` = `platinum`-'200',`prem` = '1',`prem_t` = '$tim' WHERE `id` = '" $user['id'] . "' ")) {
                
message(urlencode("Вы успешно активировали премиум"));
            }
        } else {
            
message(urlencode("Недостаточно платин"));
        }
    } else {
        
message(urlencode("у вас уже имеется премиум аккаунт"));
    }
}

function 
age_times($secs) {
    
$bit = array(
        
' year' => floor($secs 31556926),
        
' day' => $secs 86400 365,
        
' hour' => $secs 3600 24,
        
' minute' => $secs 60 60,
        
' second' => $secs 60
    
);
    
$years 0;
    
$days 0;
    
$hours 0;
    foreach (
$bit as $k => $v) {
        
$str = (string) $v;
        
$str strlen($str) == "0" $str $str;
//года
        
if ($v && $k == ' year') {
            if ((int) 
$str{strlen($str) - 1} > || (int) $str{strlen($str) - 1} == || (int) $str{strlen($str) - 2} > && (int) $str{strlen($str) - 2} < 2) {
                
$years $v;
                
$ret[] = $v ' лет ';
            } elseif ((int) 
$str{strlen($str) - 1} > && (int) $str{strlen($str) - 1} < 5) {
                
$years $v;
                
$ret[] = $v ' года ';
            } elseif ((int) 
$str{strlen($str) - 1} == 1) {
                
$years $v;
                
$ret[] = $v ' год ';
            }
        }
//дни
        
if ($v && $k == ' day') {
            if ((int) 
$str{strlen($str) - 1} > || (int) $str{strlen($str) - 1} == || (int) $str{strlen($str) - 2} > && (int) $str{strlen($str) - 2} < 2) {
                
$days $v;
                
$ret[] = $v ' дней ';
            } elseif ((int) 
$str{strlen($str) - 1} > && (int) $str{strlen($str) - 1} < 5) {
                
$days $v;
                
$ret[] = $v ' дня ';
            } elseif ((int) 
$str{strlen($str) - 1} == 1) {
                
$days $v;
                
$ret[] = $v ' день ';
            }
        }
        if (
$v && $k == ' hour' && $years == 0) {
            if (
$v && $v 21) {
                
$hours $v;
                
$ret[] = $v ' часов ';
            } elseif (
$v && $v || $v 21) {
                
$hours $v;
                
$ret[] = $v ' часа ';
            } elseif ((int) 
$str{strlen($str) - 1} == 1) {
                
$hours $v;
                
$ret[] = $v ' час ';
            }
        }
        if (
$v && $k == ' minute' && $years == && $days == 0) {
            
$ret[] = $v ' мин ';
        }
        if (
$v && $k == ' second' && $years == && $days == && $hours == 0) {
            
$ret[] = $v ' сек ';
        }
    }
    return 
join(' '$ret);
}

////////////Продажа вещи
if (isset($_GET['id']) && isset($_GET['prod']) && isset($_GET['shoppr'])) {
    
$idt = (int) $_GET['id'];
    
//заносим список айди вещей в магазе герою
    
$mc->query("UPDATE `users` SET `shopList` = '[[],[],[],[],[]]' WHERE `users`.`id` = '" $user['id'] . "'");
    if (
$idt != "" && $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `id_shop`='$idt'")->num_rows == 0) {
        
?>
        <script>/*nextshowcontemt*/showContent("/shop.php?shop=<?= $_GET['shoppr']; ?>&in&msg=<?= urlencode("Ошибка продажи предмета"); ?>");</script>
        <?php
        
exit(0);
    }
    if (
$mc->query("SELECT * FROM `shop` WHERE `id`='$idt'")->num_rows 0) {
        
$countvesh $mc->query("SELECT COUNT(0) FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `id_shop`='$idt' AND `dress`='0'")->fetch_array(MYSQLI_ASSOC);
        if (
$countvesh['COUNT(0)'] >= $_GET['prod'] && $_GET['prod'] > 0) {
            
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='$idt'")->fetch_array(MYSQLI_ASSOC);
            
$proucent 19.23;
            
$proucentMoney round(($shopmagazin['money'] * $proucent) / 100);
            
$moneyprod $user['money'] + ($proucentMoney $_GET['prod']);
            
$plataprod $user['platinum'] + ((round(($shopmagazin['platinum'] * $proucent) / 100)) * $_GET['prod']);
            
$mc->query("UPDATE `users` SET `money`='" $moneyprod "',`platinum`='" $plataprod "' WHERE `id`='" $user['id'] . "'");
            
$mc->query("DELETE FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `id_shop`='$idt' AND `dress`='0' LIMIT " $_GET['prod']);
            
?>
            <script>/*nextshowcontemt*/showContent("/shop.php?shop=<?= $_GET['shoppr']; ?>&in&msg=<?= urlencode('Продан предмет<br>' $shopmagazin['name'] . ' (' $_GET['prod'] . ')'); ?>");</script>
            <?php
            
exit(0);
        } else {
            
?>
            <script>/*nextshowcontemt*/showContent("/shop.php?shop=<?= $_GET['shoppr']; ?>&in&msg=<?= urlencode("Ошибка продажи предмета"); ?>");</script>
            <?php
            
exit(0);
        }
    } else {
        
$mc->query("DELETE FROM `userbag` WHERE `id_user`='" $user['id'] . "' && `id_shop` NOT IN (SELECT `id` FROM `shop`) LIMIT 1");
        
?>
        <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode('Предмет удалён !<br>'); ?>");
        </script>
        <?php
        
exit(0);
    }
}


//покупка
if (isset($_GET['id']) && isset($_GET['buy']) && isset($_GET['numbers']) && isset($_GET['shop'])) {
    
$idt = (int) $_GET['id'];
    
//заносим список айди вещей в магазе герою
    
$mc->query("UPDATE `users` SET `shopList` = '[[],[],[],[],[]]' WHERE `users`.`id` = '" $user['id'] . "'");

    
$num $_GET['numbers'];
    if (
$num 1) {
        
?>
        <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Нет места"); ?>");
        </script>
        <?php
        
exit(0);
    }
    
$counts $user['max_bag_count'] - $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `id_punct` < '10'")->num_rows;
    if (
$counts 32) {
        
$counts 32;
    } elseif (
$counts || $num $counts || $num 1) {
        
?>
        <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Нет свободного места"); ?>");
        </script>
        <?php
        
exit(0);
    }
    
$arrTemp0 json_decode($user['shopList']);
    if (
$idt >= && $idt count($arrTemp0[$_GET['shop'] - 1])) {
        
//получаем айдишники раздела и ыещи
        
$ids $arrTemp0[$_GET['shop'] - 1][$idt];
        
//получаем 1 шмотку из магазина
        
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='$ids'")->fetch_array(MYSQLI_ASSOC);
        
$countBagDropRes $mc->query("SELECT * FROM `userbag` WHERE `id_user` = '" $user['id'] . "' && `id_shop`='" $arrTemp0[$_GET['shop'] - 1][$idt] . "'");

        if (
$shopmagazin['max_hc'] > && $countBagDropRes->num_rows $num $shopmagazin['max_hc'] || $shopmagazin['level'] > $user['level']) {
            
?>
            <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Недостаточно денег. Перейдите в банк..."); ?>");
            </script>
            <?php
            
exit(0);
        }
        
//отсчитываем бабосы
        
$buy $user['money'] - ($shopmagazin['money'] * $num);
        
$platabuy $user['platinum'] - ($shopmagazin['platinum'] * $num);
        
//проверяем что бабосов хватило
        
if ($buy >= && $platabuy >= 0) {
            for (
$i 0$i $num$i++) {
                if (
$_GET['buy'] == 1) {
                    
//Если купить и одеть,то
                    
shop_buy($shopmagazin['id'], 'y');
                }
                if (
$_GET['buy'] == 2) {
                    
//Если купить
                    
shop_buy($shopmagazin['id'], 'n');
                }
            }
            
$mc->query("UPDATE `users` SET `money`='" $buy "',`platinum`='" $platabuy "' WHERE `id`='" $user['id'] . "'");
            
?>
            <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Куплен предмет <br>" $shopmagazin['name'] . "(" $num ")"); ?>");
            </script>
            <?php
            
exit(0);
        } else {
            
?>
            <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Недостаточно денег. Перейдите в банк."); ?>");
            </script>
            <?php
            
exit(0);
        }
    } else {
        
?>
        <script>/*nextshowcontemt*/showContent("/shop.php?msg=<?= urlencode("Недостаточно денег. Перейдите в банк.."); ?>");
        </script>
        <?php
        
exit(0);
    }
}

if (isset(
$_GET['shoppr'])) {
    
$_GET['shop'] = $_GET['shoppr'];
}
//клейма
$arrcleim = [];
$arrResultCleim = [];
//урон [lvl,id,count]
$arrcleim[] = [[1013991], [1114001], [1214011], [1314021], [1414036]];
//уворот
$arrcleim[] = [[1014091], [1114101], [1214111], [1314121], [1414136]];
//точность
$arrcleim[] = [[1014051], [1114141], [1214151], [1314211], [1414226]];
//блок
$arrcleim[] = [[1014231], [1114241], [1214251], [1314261], [1414276]];
//броня
$arrcleim[] = [[1014281], [1114291], [1214301], [1314311], [1414326]];
//оглушение
$arrcleim[] = [[1014331], [1114341], [1214351], [1314361], [1414376]];
//здоровье
$arrcleim[] = [[1014381], [1114391], [1214401], [1314411], [1414426]];
if (
$user['location'] == 56) {
    for (
$i0 0$i0 count($arrcleim); $i0++) {
        for (
$i1 0$i1 count($arrcleim[$i0]); $i1++) {
            
$numThis $mc->query("SELECT * FROM `userbag` WHERE `id_user` = '" $user['id'] . "' && `id_shop` = '" $arrcleim[$i0][$i1][1] . "'")->num_rows;
            if (
$arrcleim[$i0][$i1][0] <= $user['level'] && $numThis $arrcleim[$i0][$i1][2]) {
                
$arrResultCleim[] = $arrcleim[$i0][$i1][1];
                break;
            }
        }
    }
}
if (
$mc->query("SELECT * FROM `shop_equip` WHERE `id_location`='" $locatquest "' LIMIT 10")->num_rows || count($arrResultCleim) > 0) {
    
$arrShop = [];
    
$arrShop[0] = [];
    
$arrShop[1] = [];
    
$arrShop[2] = [];
    
$arrShop[3] = [];
    
$arrShop[4] = [];
    
$arrShop[5] = [];
    
$arrShop[6] = [];
    
$arrShop[7] = [];
    
$arrShop[8] = [];
    
$arrShop[9] = [];
    
$arrShop[10] = [];
    
$arrShop[11] = [];



    
//формируем списки вещей
    
$shop_equipAll $mc->query("SELECT * FROM `shop_equip` WHERE `id_location`='$locatquest' ORDER BY `id_punct_shop`,`level`,`platinum`,`money`")->fetch_all(MYSQLI_ASSOC);
    foreach (
$shop_equipAll as $value) {
        
//ограничения по мин макс уровню
        
$shopRes $mc->query("SELECT * FROM `shop` WHERE `id`='" $value['id_shop'] . "'");
        if (
$shopRes->num_rows 0) {
            
$shopThis $shopRes->fetch_array(MYSQLI_ASSOC);
            
$countBagDropRes $mc->query("SELECT * FROM `userbag` WHERE `id_user` = '" $user['id'] . "' && `id_shop`='" $value['id_shop'] . "'");
            if (
$user['level'] < $shopThis['drop_min_level'] || $user['level'] > $shopThis['drop_max_level'] || ($shopThis['max_hc'] > && $countBagDropRes->num_rows >= $shopThis['max_hc'])) {
                continue;
            }
        }

        
//распределение по разделам
        
if ($value['id_punct_shop'] == 1) {
            
$arrShop[0][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 2) {
            
$arrShop[1][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 3) {
            
$arrShop[2][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 4) {
            
$arrShop[3][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 5) {
            
$arrShop[4][] = $value['id_shop'];
        }

        if (
$value['id_punct_shop'] == 10) {
            
$arrShop[9][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 11) {
            
$arrShop[10][] = $value['id_shop'];
        }
        if (
$value['id_punct_shop'] == 12) {
            
$arrShop[11][] = $value['id_shop'];
        }
    }
    
$arrShop[4] = array_merge($arrShop[4], $arrResultCleim);
    
//заносим список айди вещей в магазе герою
    
$mc->query("UPDATE `users` SET `shopList` = '" json_encode($arrShop) . "' WHERE `users`.`id` = '" $user['id'] . "'");

    
//вывод разделов магазина
    
if (!isset($_GET['shop']) && !isset($_GET['id'])) {
        
?>
        <script>
            MyLib.scrollTop = 0;
        </script>
        <center>
                <div class="button_alt_01 arrowPunctShop1" onclick="showContent('event.php')">ИВЕНТ REBOOT</div>
            <?php if (count($arrShop[0]) > 0) { ?>
                <div class="button_alt_01 arrowPunctShop1" onclick="showContent('shop.php?shop=1&in')">Оружие</div>
            <?php ?>
            <?php if (count($arrShop[1]) > 0) { ?>
                <div class="button_alt_01 arrowPunctShop2" onclick="showContent('shop.php?shop=2&in')">Броня</div>
            <?php ?>
            <?php if (count($arrShop[2]) > 0) { ?>
                <div class="button_alt_01 arrowPunctShop3" onclick="showContent('shop.php?shop=3&in')">Зелья и Свитки</div>
            <?php ?>
            <?php if (count($arrShop[3]) > 0) { ?>
                <div class="button_alt_01 arrowPunctShop4" onclick="showContent('shop.php?shop=4&in')">Амулеты</div>
            <?php ?>
            <?php if (count($arrShop[4]) > 0) { ?>
                <div class="button_alt_01 arrowPunctShop5" onclick="showContent('shop.php?shop=5&in')">Разное</div>
            <?php ?>
            <?php if ($user['level'] >= 10 && $user['access'] > 3){?>
                <div class="button_alt_01" onclick="showContent('auk.php')">Аукцион</div>
            <?php ?>
            <div class="button_alt_01" onclick="showContent('shop.php?shop=6&in')">Продать</div>
            <div class="button_alt_01" onclick="showContent('shop_heroes.php')">Персонажи</div>
            <?php if ($user['level'] >= 5) { ?>
                <div class="button_alt_01" onclick="showContent('premium.php')">Премиум-аккаунт</div>
            <?php ?>
            <div class="button_alt_01" onclick="showContent('remont.php')">Ремонт</div>
            <?php if ($user['access'] > 2) { ?>
                <?php if (count($arrShop[9]) > 0) { ?>
                    <div class="button_alt_01" onclick="showContent('shop.php?shop=10&in')">Для заданий </div>
                <?php ?>
                <?php if (count($arrShop[10]) > 0) { ?>
                    <div class="button_alt_01" onclick="showContent('shop.php?shop=11&in')">Бонусы </div>
                <?php ?>
                <?php if (count($arrShop[11]) > 0) { ?>
                    <div class="button_alt_01" onclick="showContent('shop.php?shop=12&in')">Скрытые </div>
                <?php ?>
            <?php ?>
        </center>
        <?php
        $footval 
'shoptomain';
        require_once 
'system/foot/foot.php';
    }
    
//список вещей в разделе
    
if (isset($_GET['shop']) && !isset($_GET['id']) && isset($_GET['in'])) {
        
?>
        <script>
            MyLib.restore = 1;
        </script>

        <table style="font-size: 16px;padding-left: 2px;padding-right: 2px;width: 100%;margin: auto;text-align: center;">
            <tr>
                <td onclick="shopsort1(this);" class="shopminiblock sort1 allminia" style="width: 30%;">Все</td>
                <td onclick="shopsort2(this);" class="shopminiblock sort2 allminia" style="width: 30%;">Доступн.</td>
                <td onclick="shopsort3(this);" class="shopminiblock sort3 allminia" style="width: 30%;">Мой ур.</td>
            </tr>
        </table>
        <table style="font-size: 16px;padding-left: 2px;padding-right: 2px;width: 100%;margin: auto;text-align: center;">
            <tr>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="0" style="color: grey">Нет</td>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="1" style="color: green">Урон</td>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="2" style="color: blue">Уворот</td>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="3" style="color: red">Броня</td>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="4" style="color: yellow">Элита</td>
                <td onclick="shopsortStyle(this);" class="shopminiblock sortStyle" value="5" style="color: grey">Все</td>
            </tr>
        </table>
        <script>
            MyLib.userLevel = <?= $user['level']; ?>;
            MyLib.userMoney = <?= $user['money']; ?>;
            MyLib.userPlatina = <?= $user['platinum']; ?>;

            MyLib.setTimeid[200] = setTimeout(function () {
                $(".allminia:eq(" + MyLib.ticks + ")").click();
                $(".sortStyle:eq(" + MyLib.style + ")").click();
            }, 200);

            if (typeof (shopsort1) != "function") {
                shopsort1 = function (elem) {
                    $(".shopminiblock").css({fontWeight: "normal", fontSize: "16px", textDecoration: "none"});
                    $(elem).css({fontWeight: "bold", fontSize: "14px", textDecoration: "underline"});
                    $(".shopblock").each(function () {
                        $(this).show();
                    });
                    MyLib.ticks = 0;
                };
            }
            if (typeof (shopsort2) != "function") {
                shopsort2 = function (elem) {
                    $(".shopminiblock").css({fontWeight: "normal", fontSize: "16px", textDecoration: "none"});
                    $(elem).css({fontWeight: "bold", fontSize: "14px", textDecoration: "underline"});
                    $(".shopblock").each(function () {
                        $(this).attr("money") <= MyLib.userMoney && $(this).attr("platina") <= MyLib.userPlatina && $(this).attr("level") <= MyLib.userLevel ? $(this).show() : $(this).hide();
                    });
                    MyLib.ticks = 1;
                };
            }
            if (typeof (shopsort3) != "function") {
                shopsort3 = function (elem) {
                    $(".shopminiblock").css({fontWeight: "normal", fontSize: "16px", textDecoration: "none"});
                    $(elem).css({fontWeight: "bold", fontSize: "14px", textDecoration: "underline"});
                    $(".shopblock").each(function () {
                        $(this).attr("level") != MyLib.userLevel ? $(this).hide() : $(this).show();
                    });
                    MyLib.ticks = 2;
                };
            }

            if (typeof (shopsortStyle) != "function") {
                shopsortStyle = function (elem) {
                    $(".sortStyle").css({fontWeight: "normal", fontSize: "16px", textDecoration: "none"});
                    $(elem).css({fontWeight: "bold", fontSize: "14px", textDecoration: "underline"});
                    MyLib.style = $(elem).attr("value");
                    if (MyLib.ticks == 0) {
                        $(".shopblock").each(function () {
                            $(this).attr("stail") == MyLib.style || MyLib.style == 5 ? $(this).show() : $(this).hide();
                        });
                    }
                    if (MyLib.ticks == 1) {
                        $(".shopblock").each(function () {
                            $(this).attr("stail") == MyLib.style && $(this).attr("money") <= MyLib.userMoney && $(this).attr("platina") <= MyLib.userPlatina && $(this).attr("level") <= MyLib.userLevel ||
                                    MyLib.style == 5 && $(this).attr("money") <= MyLib.userMoney && $(this).attr("platina") <= MyLib.userPlatina && $(this).attr("level") <= MyLib.userLevel ? $(this).show() : $(this).hide();
                        });
                    }
                    if (MyLib.ticks == 2) {
                        $(".shopblock").each(function () {
                            $(this).attr("stail") == MyLib.style && $(this).attr("level") == MyLib.userLevel || MyLib.style == 5 && $(this).attr("level") == MyLib.userLevel ? $(this).show() : $(this).hide();
                        });
                    }
                };
            }

        </script>
        <?php
        
//выводим что купить
        
if (isset($_GET['shop']) && $_GET['shop'] > && $_GET['shop'] < || $user['access'] > && isset($_GET['shop']) && $_GET['shop'] > && $_GET['shop'] < 13) {
            
//получаем айдишники раздела
            
$ids json_decode($user['shopList'])[$_GET['shop'] - 1];
            for (
$x 0$x count($ids); $x++) {
                
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='" $ids[$x] . "'")->fetch_array(MYSQLI_ASSOC);
                
?>
                <div class="shops shopblock" 
                     level="<?= $shopmagazin['level']; ?>
                     money="<?= $shopmagazin['money']; ?>
                     platina="<?= $shopmagazin['platinum']; ?>
                     stail="<?= $shopmagazin['stil']; ?>">
                    <a onclick="MyLib.save = 1;
                                            showContent('shop.php?shop=<?= $_GET['shop']; ?>&id=<?= $x?>')">
                        <table  class="table_block2" >
                            <tr>
                                <td style="width: 90px;">
                                    <div class="shopicobg shopico<?= $shopmagazin['id_image']; ?>">
                                    </div>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td class="arrowShop<?= $ids[$x]; ?>">
                                                <?= $shopmagazin['name'?>
                                                <?php
                                                
if ($user['access'] > 2) {
                                                    echo
' (id: ' $shopmagazin['id'] . ')';
                                                }
                                                
?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <?php
                                                
if ($shopmagazin['stil'] > 0) {
                                                    
$colorStyle = ["black""green""blue""red""yellow"];
                                                    
//$textStyle = ["", "Моща", "Прыг", "Танк", "Цари"];
                                                    
$textStyle = ["""Урон""Уворот""Броня""Элита"];
                                                    echo 
'<font style="color:' $colorStyle[$shopmagazin['stil']] . ';font-weight: bold;">' $textStyle[$shopmagazin['stil']] . '</font>';
                                                }
                                                
?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Уровень: <?= $shopmagazin['level']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Цена:
                                                <?php
                                                $zolo 
money($shopmagazin['money'], "zoloto");
                                                
$med money($shopmagazin['money'], "med");
                                                
$serebro money($shopmagazin['money'], "serebro");
                                                
$platinum $shopmagazin['platinum'];

                                                if (
$platinum 0) {
                                                    
?>
                                                    <img src="/images/icons/plata.png" width="16px"><?= $platinum?>
                                                <?php }if ($zolo 0) { ?>
                                                    <img src="/images/icons/zoloto.png" width="16px"><?= $zolo?>
                                                <?php }if ($serebro 0) { ?>
                                                    <img src="/images/icons/serebro.png" width="16px"><?= $serebro?>
                                                <?php }if ($med 0) { ?>
                                                    <img src="/images/icons/med.png" width="16px"><?= $med?>
                                                <?php ?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </a>
                </div>
                <?php
            
}
            
?>
            <?php
        
}


        
//выводим что продать
        
if ($_GET['shop'] == 6) {
            
$shopmagazin1 $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `dress`='0' AND `id_punct` < '10' GROUP BY `id_shop`");
            while (
$shopmagazin2 $shopmagazin1->fetch_array(MYSQLI_ASSOC)) {
                
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='" $shopmagazin2['id_shop'] . "'")->fetch_array(MYSQLI_ASSOC);
                
$counts $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `dress`='0' AND `id_shop`='" $shopmagazin2['id_shop'] . "'")->num_rows;
                
?>
                <div class="shops shopblock" 
                     level="<?= $shopmagazin['level']; ?>
                     money="<?= $shopmagazin['money']; ?>
                     platina="<?= $shopmagazin['platinum']; ?>
                     stail="<?= $shopmagazin['stil']; ?>">
                    <a onclick="MyLib.save = 1;
                                            showContent('shop.php?shoppr=<?= $_GET['shop']; ?>&id=<?= $shopmagazin['id']; ?>&prodsee')">
                        <table  class="table_block2" >
                            <tr>
                                <td style="width: 90px;">
                                    <div class="shopicobg shopico<?= $shopmagazin['id_image']; ?>"></div>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                <?php
                                                
echo $shopmagazin['name'];
                                                if (
$counts 1) {
                                                    echo 
" (" $counts ")";
                                                }
                                                
?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <?php
                                                
if ($shopmagazin['stil'] > 0) {
                                                    
$colorStyle = ["black""green""blue""red""yellow"];
                                                    
//$textStyle = ["", "Моща", "Прыг", "Танк", "Цари"];
                                                    
$textStyle = ["""Урон""Уворот""Броня""Элита"];
                                                    echo 
'<font style="color:' $colorStyle[$shopmagazin['stil']] . ';font-weight: bold;">' $textStyle[$shopmagazin['stil']] . '</font>';
                                                }
                                                
?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Уровень: <?= $shopmagazin['level']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Цена:
                                                <?php
                                                $proucent 
19.23;
                                                
$proucentMoney round(($shopmagazin['money'] * $proucent) / 100);

                                                
$zolo money($proucentMoney"zoloto");
                                                
$med money($proucentMoney"med");
                                                
$serebro money($proucentMoney"serebro");
                                                
$platinum round(($shopmagazin['platinum'] * $proucent) / 100);

                                                if (
$platinum 0) {
                                                    
?>
                                                    <img src="/images/icons/plata.png" width="16px"><?= $platinum?>
                                                <?php }if ($zolo 0) { ?>
                                                    <img src="/images/icons/zoloto.png" width="16px"><?= $zolo?>
                                                <?php }if ($serebro 0) { ?>
                                                    <img src="/images/icons/serebro.png" width="16px"><?= $serebro?>
                                                <?php }if ($med 0) { ?>
                                                    <img src="/images/icons/med.png" width="16px"><?= $med?>
                                                <?php ?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </a>
                </div>
                <?php
            
}
        }
        
$footval 'backtoshop';
        require_once 
'system/foot/foot.php';
    }

    
//просмотреть конкретную вещь покупка
    
if ($user['access'] > && isset($_GET['shop']) && $_GET['shop'] < 13 && $_GET['shop'] > && isset($_GET['id']) || isset($_GET['shop']) && $_GET['shop'] < && $_GET['shop'] > && isset($_GET['id'])) {
        
?>
        <hr class="hr_02" style="margin-top: -5px;"><?php
        
//получаем айдишники раздела и айди вещи
        
$ids json_decode($user['shopList'])[$_GET['shop'] - 1][$_GET['id']];
        
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='$ids'")->fetch_array(MYSQLI_ASSOC);
        
$counts $user['max_bag_count'] - $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `id_punct` < '10'")->num_rows;
        if (
$counts 32) {
            
$counts 32;
        } elseif (
$counts 1) {
            
$counts 0;
        }
        if (
$shopmagazin['health'] < 0) {
            
$maghealth '';
        } else {
            
$maghealth '+';
        }
        if (
$shopmagazin['strength'] < 0) {
            
$magstrength '';
        } else {
            
$magstrength '+';
        }
        if (
$shopmagazin['toch'] < 0) {
            
$magtoch '';
        } else {
            
$magtoch '+';
        }
        if (
$shopmagazin['lov'] < 0) {
            
$maglov '';
        } else {
            
$maglov '+';
        }
        if (
$shopmagazin['kd'] < 0) {
            
$magkd '';
        } else {
            
$magkd '+';
        }
        if (
$shopmagazin['block'] < 0) {
            
$magblock '';
        } else {
            
$magblock '+';
        }
        
$nameeffects "";
        if (isset(
$shopmagazin['nameeffects'])) {
            
$effects explode("|"$shopmagazin['nameeffects']);
            for (
$i 0count($effects) > $i$i++) {
                if (
$effects[$i] !== "") {
                    
$nameeffects .= "<b style='padding-top: 3px;padding-bottom: 3px;'>" $effects[$i] . "</b><br>";
                }
            }
        }
        if (
$shopmagazin['bron'] < 0) {
            
$magbron '';
        } else {
            
$magbron '+';
        }
        
?>
        <center style="padding-top: 3px;padding-bottom: 3px;text-align: center;">
            <b>
                <?= $shopmagazin['name']; ?>
            </b>
        </center>
        <table  class="table_block2" style="width: 98%;">
            <tr>
                <td  style="width: 90px;padding-top: 3px;padding-bottom: 3px;">
                    <div class="shopicobg shopico<?= $shopmagazin['id_image']; ?>">
                    </div>
                </td>
                <td style="display: unset;">
                    <?= $shopmagazin['opisanie']; ?>
                </td>
            </tr>
        </table>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="padding-top: 3px;padding-bottom: 3px;">
                    <?php
                    
if ($shopmagazin['stil'] > 0) {
                        
$colorStyle = ["black""green""blue""red""yellow"];
                        
//$textStyle = ["", "Моща", "Прыг", "Танк", "Цари"];
                        
$textStyle = ["""Урон""Уворот""Броня""Элита"];
                        echo 
'<font style="color:' $colorStyle[$shopmagazin['stil']] . ';font-weight: bold;">' $textStyle[$shopmagazin['stil']] . '</font>';
                    }
                    
?>
                </td>
            </tr>  
        </table>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width: 140px;padding-top: 3px;padding-bottom: 3px;">Уровень:</td>
                <td>
                    <img src="/img/img23.png" width="16px">
                    <?= $shopmagazin['level']; ?>
                </td>
            </tr>
            <tr>
                <td style="width: 140px;padding-top: 3px;padding-bottom: 3px;">Цена:</td>
                <td>
                    <?php
                    
if (isset($_GET['shop'])) {

                        
$zolo money($shopmagazin['money'], "zoloto");
                        
$med money($shopmagazin['money'], "med");
                        
$serebro money($shopmagazin['money'], "serebro");
                        
$platinum $shopmagazin['platinum'];
                        
$Money $shopmagazin['money'];
                    }

                    if (isset(
$_GET['shoppr'])) {
                        
$proucent 19.23;
                        
$proucentMoney round(($shopmagazin['money'] * $proucent) / 100);

                        
$zolo money($proucentMoney"zoloto");
                        
$med money($proucentMoney"med");
                        
$serebro money($proucentMoney"serebro");
                        
$platinum round(($shopmagazin['platinum'] * $proucent) / 100);
                    }

                    if (
$platinum 0) {
                        
?>
                        <img src="/images/icons/plata.png" width="16px">
                        <?= $platinum ?>
                    <?php }if ($zolo 0) { ?>
                        <img src="/images/icons/zoloto.png" width="16px">
                        <?= $zolo ?>
                    <?php }if ($serebro 0) { ?>
                        <img src="/images/icons/serebro.png" width="16px">
                        <?= $serebro ?>
                    <?php }if ($med 0) { ?>
                        <img src="/images/icons/med.png" width="16px">
                        <?= $med?>
                    <?php ?>
                </td>
            </tr>
            <?php if ($shopmagazin['koll'] > -1) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Количество:</td>
                    <td><?= $shopmagazin['koll']; ?></td>
                </tr>
            <?php }if ($shopmagazin['iznos'] > -1) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Износ:</td>
                    <td><?= $shopmagazin['iznos']; ?></td>
                </tr>
            <?php }if ($shopmagazin['time_s'] > 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Годность время:</td>
                    <td><?= age_times($shopmagazin['time_s']); ?></td>
                </tr>
            <?php }if ($shopmagazin['toch'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Точность:</td>
                    <td><?= ico('icons''toch.png') . " " $magtoch $shopmagazin['toch']; ?></td>
                </tr>
            <?php }if ($shopmagazin['strength'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Урон:</td>
                    <td><?= ico('icons''power.jpg') . " " $magstrength $shopmagazin['strength']; ?></td>
                </tr>
            <?php }if ($shopmagazin['block'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Блок:</td>
                    <td><?= ico('icons''shit.png') . " " $magblock $shopmagazin['block']; ?></td>
                </tr>
            <?php }if ($shopmagazin['kd'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Оглушение:</td>
                    <td><?= ico('icons''kd.png') . " " $magkd $shopmagazin['kd']; ?></td>
                </tr>
            <?php }if ($shopmagazin['lov'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Уворот:</td>
                    <td><?= ico('icons''img235.png') . " " $maglov $shopmagazin['lov']; ?></td>
                </tr>    
            <?php }if ($shopmagazin['bron'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Броня:</td>
                    <td><?= ico('icons''bron.png') . " " $magbron $shopmagazin['bron']; ?></td>
                </tr>    
            <?php }if ($shopmagazin['health'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Здоровье:</td>
                    <td><?= ico('icons''hp.png') . " " $maghealth $shopmagazin['health']; ?></td>
                </tr>
            <?php ?> 
        </table> 
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width:100%;padding-top: 3px;padding-bottom: 3px;"><?= $nameeffects?></td>
            </tr>
        </table>
        <br>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width: 20px;"> </td>
                <td >
                    <?php if ($user['access'] > 2) { ?>
                        <b>ID вещи: <?= $shopmagazin['id']; ?></b>
                        <div><a onclick="showContent('/admin/shop.php?shop=edit&id=<?= $shopmagazin['id']; ?>')">Изменить (Админ)</a></div><br>
                        <?php
                    
}
                    if (
$shopmagazin['level'] <= $user['level']) {
                        
?>
                        <div onselectstart="return false" onmousedown="return false" >
                            <table>
                                <tr>
                                    <td <?= $_GET['shop'] > && $_GET['shop'] < "" "hidden"?> class="shophref" onclick="NumCount(-1);" style="font-weight: bold;padding: 10px;">&lt;&lt;</td>
                                    <td <?= $_GET['shop'] > && $_GET['shop'] < "" "hidden"?> class="shophref" id="num" style="text-decoration: underline;font-weight: bold;padding: 10px;">1</td>
                                    <td <?= $_GET['shop'] > && $_GET['shop'] < "" "hidden"?> class="shophref" onclick="NumCount(1);" style="font-weight: bold;padding: 10px;">&gt;&gt;</td>
                                    <td class="shophref" style="font-weight: bold;padding: 10px;"><b id="moneyNum"></b></td>
                                </tr>
                            </table>
                            <table>
                                <tr>
                                    <td class="shophref" onclick="showContent('shop.php?id=<?= $_GET['id']; ?>&buy=1&shop=<?= $_GET['shop']; ?>&numbers=' + num.innerHTML)" style="text-decoration: underline;font-weight: bold;padding-top: 10px;padding-bottom: 10px;">
                                        купить и одеть
                                    </td>
                                </tr>
                                <tr>
                                    <td class="shophref arrowShop<?= $shopmagazin['id']; ?>" onclick="showContent('shop.php?id=<?= $_GET['id']; ?>&buy=2&shop=<?= $_GET['shop']; ?>&numbers=' + num.innerHTML)" style="text-decoration: underline;font-weight: bold;padding-top: 10px;padding-bottom: 10px;">
                                        купить
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <script>
                            maxCount = <?= $counts?>;
                            myCount = 1;
                            money = <?= $Money?>;
                            moneyTov = <?= $Money?>;
                            plata = <?= $platinum?>;
                            plataTov = <?= $platinum?>;
                            NumCount(0);
                            function NumCount(numc) {
                                myCount = Number(numc) + Number(myCount);
                                money = Number(money) + (Number(numc) * Number(moneyTov));
                                plata = Number(plata) + (Number(numc) * Number(plataTov));

                                if (myCount < 1) {
                                    myCount = 1;
                                    money = moneyTov;
                                    plata = plataTov;
                                }

                                if (myCount > maxCount) {
                                    myCount = maxCount;
                                    money = Number(moneyTov) * Number(maxCount);
                                    plata = Number(plataTov) * Number(maxCount);

                                }

                                med = Number(money) % 100;///медь
                                serebro = (money - med) / 100 % 100;
                                zoloto = Math.floor((((money - med) / 100) - serebro) / 100);

                                moneyNum.innerHTML = ' ';
                                if (plata > 0) {
                                    moneyNum.innerHTML += '<img src="/images/icons/plata.png" width="16px">' + plata;
                                }
                                if (zoloto > 0) {
                                    moneyNum.innerHTML += '<img src="/images/icons/zoloto.png" width="16px">' + zoloto;
                                }
                                if (serebro > 0) {
                                    moneyNum.innerHTML += '<img src="/images/icons/serebro.png" width="16px">' + serebro;
                                }
                                if (med > 0) {
                                    moneyNum.innerHTML += '<img src="/images/icons/med.png" width="16px">' + med;
                                }
                                num.innerHTML = myCount;
                            }
                        </script>
                    <?php ?>
                </td>
            </tr>
        </table>
        <?php
        $footval 
'backtoshopshop';
        require_once 
'system/foot/foot.php';
    }

    
//просмотреть конкретную вещь продажа
    
if (isset($_GET['shop']) && $_GET['shop'] == && isset($_GET['id'])) {
        
?>
        <hr class="hr_02" style="margin-top: -5px;"><?php
        
//получаем айдишники раздела и айди вещи
        
$shopmagazin $mc->query("SELECT * FROM `shop` WHERE `id`='" $_GET['id'] . "'")->fetch_array(MYSQLI_ASSOC);
        
$counts $mc->query("SELECT * FROM `userbag` WHERE `id_user`='" $user['id'] . "' AND `dress`='0' AND `id_shop`='" $_GET['id'] . "'")->num_rows;
        
//echo "Кол-во данных вещей: ".$counts;
        
if($counts == 0)
        {
            
?><script>showContent("/shop.php?shop=<?= $_GET['shoppr']; ?>&in&msg=<?= urlencode("Предмет не найден"); ?>");</script><?php
            
exit(0);        
        }
        if (
$shopmagazin['health'] < 0) {
            
$maghealth '';
        } else {
            
$maghealth '+';
        }
        if (
$shopmagazin['strength'] < 0) {
            
$magstrength '';
        } else {
            
$magstrength '+';
        }
        if (
$shopmagazin['toch'] < 0) {
            
$magtoch '';
        } else {
            
$magtoch '+';
        }
        if (
$shopmagazin['lov'] < 0) {
            
$maglov '';
        } else {
            
$maglov '+';
        }
        if (
$shopmagazin['kd'] < 0) {
            
$magkd '';
        } else {
            
$magkd '+';
        }
        if (
$shopmagazin['block'] < 0) {
            
$magblock '';
        } else {
            
$magblock '+';
        }
        
$nameeffects "";
        if (isset(
$shopmagazin['nameeffects'])) {
            
$effects explode("|"$shopmagazin['nameeffects']);
            for (
$i 0count($effects) > $i$i++) {
                if (
$effects[$i] !== "") {
                    
$nameeffects .= "<b style='padding-top: 3px;padding-bottom: 3px;'>" $effects[$i] . "</b><br>";
                }
            }
        }
        if (
$shopmagazin['bron'] < 0) {
            
$magbron '';
        } else {
            
$magbron '+';
        }
        
?>
        <center style="padding-top: 3px;padding-bottom: 3px;text-align: center;">
            <b>
                <?= $shopmagazin['name']; ?>
            </b>
        </center>
        <table  class="table_block2" style="width: 98%;">
            <tr>
                <td  style="width: 90px;padding-top: 3px;padding-bottom: 3px;">
                    <div class="shopicobg shopico<?= $shopmagazin['id_image']; ?>">
                    </div>
                </td>
                <td style="display: unset;">
                    <?= $shopmagazin['opisanie']; ?>
                </td>
            </tr>
        </table>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="padding-top: 3px;padding-bottom: 3px;">
                    <?php
                    
if ($shopmagazin['stil'] > 0) {
                        
$colorStyle = ["black""green""blue""red""yellow"];
                        
//$textStyle = ["", "Моща", "Прыг", "Танк", "Цари"];
                        
$textStyle = ["""Урон""Уворот""Броня""Элита"];
                        echo 
'<font style="color:' $colorStyle[$shopmagazin['stil']] . ';font-weight: bold;">' $textStyle[$shopmagazin['stil']] . '</font>';
                    }
                    
?>
                </td>
            </tr>  
        </table>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width: 140px;padding-top: 3px;padding-bottom: 3px;">Уровень:</td>
                <td>
                    <img src="/img/img23.png" width="16px">
                    <?= $shopmagazin['level']; ?>
                </td>
            </tr>
            <tr>
                <td style="width: 140px;padding-top: 3px;padding-bottom: 3px;">Цена:</td>
                <td>
                    <?php
                    
if (isset($_GET['shop'])) {

                        
$zolo money($shopmagazin['money'], "zoloto");
                        
$med money($shopmagazin['money'], "med");
                        
$serebro money($shopmagazin['money'], "serebro");
                        
$platinum $shopmagazin['platinum'];
                        
$Money $shopmagazin['money'];
                    }

                    if (isset(
$_GET['shoppr'])) {
                        
$proucent 19.23;
                        
$proucentMoney round(($shopmagazin['money'] * $proucent) / 100);

                        
$zolo money($proucentMoney"zoloto");
                        
$med money($proucentMoney"med");
                        
$serebro money($proucentMoney"serebro");
                        
$platinum round(($shopmagazin['platinum'] * $proucent) / 100);
                    }

                    if (
$platinum 0) {
                        
?>
                        <img src="/images/icons/plata.png" width="16px">
                        <?= $platinum ?>
                    <?php }if ($zolo 0) { ?>
                        <img src="/images/icons/zoloto.png" width="16px">
                        <?= $zolo ?>
                    <?php }if ($serebro 0) { ?>
                        <img src="/images/icons/serebro.png" width="16px">
                        <?= $serebro ?>
                    <?php }if ($med 0) { ?>
                        <img src="/images/icons/med.png" width="16px">
                        <?= $med?>
                    <?php ?>
                </td>
            </tr>
            <?php if ($shopmagazin['koll'] > -1) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Количество:</td>
                    <td><?= $shopmagazin['koll']; ?></td>
                </tr>
            <?php }if ($shopmagazin['iznos'] > -1) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Износ:</td>
                    <td><?= $shopmagazin['iznos']; ?></td>
                </tr>
            <?php }if ($shopmagazin['time_s'] > 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Годность время:</td>
                    <td><?= age_times($shopmagazin['time_s']); ?></td>
                </tr>
            <?php }if ($shopmagazin['toch'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Точность:</td>
                    <td><?= ico('icons''toch.png') . " " $magtoch $shopmagazin['toch']; ?></td>
                </tr>
            <?php }if ($shopmagazin['strength'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Урон:</td>
                    <td><?= ico('icons''power.jpg') . " " $magstrength $shopmagazin['strength']; ?></td>
                </tr>
            <?php }if ($shopmagazin['block'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Блок:</td>
                    <td><?= ico('icons''shit.png') . " " $magblock $shopmagazin['block']; ?></td>
                </tr>
            <?php }if ($shopmagazin['kd'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Оглушение:</td>
                    <td><?= ico('icons''kd.png') . " " $magkd $shopmagazin['kd']; ?></td>
                </tr>
            <?php }if ($shopmagazin['lov'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Уворот:</td>
                    <td><?= ico('icons''img235.png') . " " $maglov $shopmagazin['lov']; ?></td>
                </tr>    
            <?php }if ($shopmagazin['bron'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Броня:</td>
                    <td><?= ico('icons''bron.png') . " " $magbron $shopmagazin['bron']; ?></td>
                </tr>    
            <?php }if ($shopmagazin['health'] != 0) { ?>
                <tr>
                    <td style="padding-top: 3px;padding-bottom: 3px;">Здоровье:</td>
                    <td><?= ico('icons''hp.png') . " " $maghealth $shopmagazin['health']; ?></td>
                </tr>
            <?php ?> 
        </table> 
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width:100%;padding-top: 3px;padding-bottom: 3px;"><?= $nameeffects?></td>
            </tr>
        </table>
        <br>
        <table  class="table_block2" style="width: 96%;">
            <tr>
                <td style="width: 20px;"> </td>
                <td >
                    <?php if ($user['access'] > 2) { ?>
                        <b>ID вещи: <?= $shopmagazin['id']; ?></b>
                        <div><a onclick="showContent('/admin/shop.php?shop=edit&id=<?= $shopmagazin['id']; ?>')">Изменить (Админ)</a></div><br>
                    <?php ?>
                    <div onselectstart="return false" onmousedown="return false" >
                        <table>
                            <tr>
                                <td <?= $counts "" "hidden"?> class="shophref" onclick="NumCount(-1);" style="font-weight: bold;padding: 10px;">&lt;&lt;</td>
                                <td <?= $counts "" "hidden"?> class="shophref" id="num" style="text-decoration: underline;font-weight: bold;padding: 10px;">1</td>
                                <td <?= $counts "" "hidden"?> class="shophref" onclick="NumCount(1);" style="font-weight: bold;padding: 10px;">&gt;&gt;</td>
                                <td class="shophref" style="font-weight: bold;padding: 10px;"><b id="moneyNum"></b></td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td class="shophref" onclick="showContent('shop.php?shoppr=<?= $_GET['shoppr']; ?>&id=<?= $_GET['id']; ?>&prod=' + num.innerHTML)" style="text-decoration: underline;font-weight: bold;padding-top: 10px;padding-bottom: 10px;">
                                    продать
                                </td>
                            </tr>
                        </table>
                    </div>
                    <script>
                        maxCount = <?= $counts?>;
                        myCount = 1;
                        money = <?= $proucentMoney?>;
                        moneyTov = <?= $proucentMoney?>;
                        plata = <?= $platinum?>;
                        plataTov = <?= $platinum?>;
                        NumCount(0);
                        function NumCount(numc) {
                            myCount = Number(numc) + Number(myCount);
                            money = Number(money) + (Number(numc) * Number(moneyTov));
                            plata = Number(plata) + (Number(numc) * Number(plataTov));

                            if (myCount < 1) {
                                myCount = 1;
                                money = moneyTov;
                                plata = plataTov;
                            }

                            if (myCount > maxCount) {
                                myCount = maxCount;
                                money = Number(moneyTov) * Number(maxCount);
                                plata = Number(plataTov) * Number(maxCount);

                            }

                            med = Number(money) % 100;///медь
                            serebro = (money - med) / 100 % 100;
                            zoloto = Math.floor((((money - med) / 100) - serebro) / 100);

                            moneyNum.innerHTML = ' ';
                            if (plata > 0) {
                                moneyNum.innerHTML += '<img src="/images/icons/plata.png" width="16px">' + plata;
                            }
                            if (zoloto > 0) {
                                moneyNum.innerHTML += '<img src="/images/icons/zoloto.png" width="16px">' + zoloto;
                            }
                            if (serebro > 0) {
                                moneyNum.innerHTML += '<img src="/images/icons/serebro.png" width="16px">' + serebro;
                            }
                            if (med > 0) {
                                moneyNum.innerHTML += '<img src="/images/icons/med.png" width="16px">' + med;
                            }
                            num.innerHTML = myCount;
                        }
                    </script>
                </td>
            </tr>
        </table>
        <?php
        $footval 
'backtoshopshop';
        require_once 
'system/foot/foot.php';
    }
} else {
    
//заносим список айди вещей в магазе герою
    
$mc->query("UPDATE `users` SET `shopList` = '[[],[],[],[],[]]' WHERE `users`.`id` = '" $user['id'] . "'");
    
?>
    <center>
        <br>
        <br> Здесь нет магазина, магазины 
        <br> расположены в городах
    </center>
    <?php
    $footval 
'shoptomain';
    require_once 
'system/foot/foot.php';
}
Онлайн: 1
Реклама