Вход Регистрация
Файл: html/shop_gift.php
Строк: 78
<?php
require_once ('system/func.php');
if (isset(
$_GET['menu']) && isset($_GET['id']) || isset($_GET['name']) && isset($_GET['id'])) {
    
?>
    <center>-Выбор подарка-</center>
    <table class="table_block2">
        <tr>
            <td class="block101" style="width: 2%"></td>
            <td class="block102" style="width: 96%"></td>
            <td class="block103" style="width: 2%"></td>
        </tr>
        <tr>
            <td class="block104" style="width: 2%"></td>
            <td class="block105" style="width: 96%">
                <?php
                $shop_gift 
$mc->query("SELECT * FROM `shop_gift` ORDER BY `plata` ASC");
                while (
$result $shop_gift->fetch_array(MYSQLI_ASSOC)) {
                    
?>
                    <table style="width: 100%;margin: auto;">

                        <tr>
                            <td style="width:50%;text-align: right">
                                <img style="width: 80px;height: 80px;" src="/images/gifts/<?= $result['img']; ?>.png">
                            </td>
                            <td style="max-width:100%">
                                <b>
                                    <ins>
                                        <a onclick="showContent('shop_gift.php?punct=<?= $result['id']; ?>&id=<?= $_GET['id']; ?>')"><?= $result['name']; ?>
                                        </a>
                                    </ins>
                                </b>
                                <br>
                                цена:
                                <img src="/images/icons/plata.png"><?= $result['plata']; ?>
                            </td>
                        </tr>
                    </table>
                <?php ?>
            </td>
            <td class="block106" style="width: 2%"></td>
        </tr>
        <tr>
            <td class="block107"></td>
            <td class="block108"></td>
            <td class="block109"></td>
        </tr>
    </table>          
    <?php
}

if (isset(
$_GET['punct']) && isset($_GET['text']) && isset($_GET['id']) && isset($_GET['name'])) {
    
$gift $mc->query("SELECT * FROM `shop_gift` WHERE `id` = '" $_GET['punct'] . "'")->fetch_array(MYSQLI_ASSOC);
    
$user_1 $mc->query("SELECT * FROM `users` WHERE `id` = '" $_GET['id'] . "'")->fetch_array(MYSQLI_ASSOC);
    if (isset(
$user_1) && $user['platinum'] > && $user['platinum'] >= $gift['plata']) {
        
$plat$user['platinum']-$gift['plata'];
        
$mc->query("UPDATE `users` SET `platinum`='$plat' WHERE `id`='" $user['id'] . "'");
        
$anonymous 0;
        if (
$_GET['name'] == 0) {
            
$anonymous $user['id'];
        }
        if (
$mc->query("INSERT INTO `gifts`("
                        
"`id`, `id_1`, `id_2`, `id_img`, `text`, `name` , `date_gifts`, `anonymous`"
                        
") VALUES ("
                        
"NULL,"
                        
"'" $user['id'] . "',"
                        
"'" $user_1['id'] . "',"
                        
"'" $gift['img'] . "',"
                        
"'" $_GET['text'] . "',"
                        
"'" $gift['name'] . "',"
                        
"'" date('Y-m-d H:i:s') . "',"
                        
"'$anonymous'"
                        
")")
        ) {
            
$mc->query("INSERT INTO `msg`("
                    
"`id`,"
                    
" `id_user`,"
                    
" `message`,"
                    
" `type`,"
                    
" `date`"
                    
")VALUES("
                    
"NULL,"
                    
"'" $user_1['id'] . "',"
                    
"'" urldecode('Вам подарок .') . "',"
                    
."'gifts',"
                    
"'" time() . "'"
                    
")");
            
message(urlencode("Подарок отправлен " $mc->error));
        } else {
            
message(urlencode("<font style='color:red'>ошибка 76476</font>"));
        }
    } else {
        
message(urlencode("Недостаточно средств"));
    }
}

if (isset(
$_GET['punct']) && isset($_GET['id']) && !isset($_GET['name'])) {
    
$gift $mc->query("SELECT * FROM `shop_gift` WHERE `id` = '" $_GET['punct'] . "'")->fetch_array(MYSQLI_ASSOC);
    
$user_1 $mc->query("SELECT * FROM `users` WHERE `id` = '" $_GET['id'] . "'")->fetch_array(MYSQLI_ASSOC);
    
?>
    <center>
        Подарок для <?= $user_1['name']; ?>
        <br>
        <img src="/images/gifts/<?= $gift['img']; ?>.png">
        <br>
        <?= $gift['name']; ?>
        <br>
    </center>
    <center>    
        <input type="checkbox" name="sches" value="off">
        анонимно
        <br>
        Сообщение:
        <br>
        <input type="text" class="input_real chat_input txt" name="text">
        <br>
        <input id="send" class="button_alt_01" onclick="send();" type="submit" value="Отправить" style="margin-bottom: -4px;width:280px;">
    </center>
    <script>
        var bool = 0;
        var name = 1;
        function send() {
            if (bool == 0) {
                bool = 1;
                if ($("input[name=sches]").prop("checked") == false) {
                    name = 0;
                }
                showContent('shop_gift.php?text=' + $(".txt").val() + "&id=<?= $_GET['id']; ?>&punct=<?= $_GET['punct']; ?>&name=" + name);
            }
        }
    </script>
    <?php
}
$footval "top";
require_once (
'system/foot/foot.php');
?>
Онлайн: 1
Реклама