Вход Регистрация
Файл: html/admin/hunt_equip/edit.php
Строк: 149
<?php
require_once '../../system/func.php';
if (!
$user OR $user['access'] < 3) {
    
?><script>showContent("/");</script><?php
    
exit(0);
}
$footval 'hunt_edit';
include 
'../../system/foot/foot.php';
$id_loc 0;
if (isset(
$_GET['id_loc'])) {
    
$id_loc $_GET['id_loc'];
}
$thisloc $mc->query("SELECT * FROM `location` WHERE `id` = '$id_loc'")->fetch_array(MYSQLI_ASSOC);
if (isset(
$_GET['delete']) && $_GET['delete'] > 0) {
    
$mob $mc->query("SELECT * FROM `hunt_equip` WHERE `id` = '" $_GET['delete'] . "'")->fetch_array(MYSQLI_ASSOC);
    
$mc->query("DELETE FROM `hunt_equip` WHERE `id` = '" $_GET['delete'] . "' LIMIT 1");
    
$chatmsg "<a onclick=\'showContent(\"/profile.php?id=" $user['id'] . "\")\'><font color=\'#0033cc\'>" $user['name'] . "</font></a><font color=\'#0033cc\'> убрал моба </font><a onclick=\'showContent(\"/admin/hunt_equip/edit.php?id_loc=" $id_loc "\")\'><font color=\'#0033cc\'>" $mob['name'] . " из " $thisloc['Name'] . "</font></a><font color=\'#0033cc\'> !</font>";
    
$mc->query("INSERT INTO `chat`("
            
"`id`,"
            
"`name`,"
            
"`id_user`,"
            
"`chat_room`,"
            
"`msg`,"
            
"`msg2`,"
            
"`time`,"
            
" `unix_time"
            
"`) VALUES ("
            
"NULL,"
            
"'АДМИНИСТРИРОВАНИЕ',"
            
"'',"
            
"'5',"
            
" '" $chatmsg "',"
            
"'',"
            
"'',"
            
"''"
            
" )");
}
if (isset(
$_GET['add']) && $_GET['add'] > 0) {
    
$mob $mc->query("SELECT * FROM `hunt` WHERE `id` = '" $_GET['add'] . "'")->fetch_array(MYSQLI_ASSOC);
    
$mc->query("INSERT INTO `hunt_equip` "
            
"("
            
" `id`,"
            
" `id_hunt`,"
            
" `id_loc`,"
            
" `name`,"
            
" `level`"
            
")VALUES ("
            
"NULL,"
            
" '" $_GET['add'] . "',"
            
" '$id_loc',"
            
" '" $mob['name'] . "',"
            
" '" $mob['level'] . "'"
            
");");
    if (empty(
$mob['name'])) {
        
$mob['name'] = "???";
    }

    
$chatmsg "<a onclick=\'showContent(\"/profile.php?id=" $user['id'] . "\")\'><font color=\'#0033cc\'>" $user['name'] . "</font></a><font color=\'#0033cc\'> добавил моба </font><a onclick=\'showContent(\"/admin/hunt_equip/edit.php?id_loc=" $id_loc "\")\'><font color=\'#0033cc\'>" $mob['name'] . " в " $thisloc['Name'] . "</font></a><font color=\'#0033cc\'> !</font>";
    
$mc->query("INSERT INTO `chat`("
            
"`id`,"
            
"`name`,"
            
"`id_user`,"
            
"`chat_room`,"
            
"`msg`,"
            
"`msg2`,"
            
"`time`,"
            
" `unix_time"
            
"`) VALUES ("
            
"NULL,"
            
"'АДМИНИСТРИРОВАНИЕ',"
            
"'',"
            
"'5',"
            
" '" $chatmsg "',"
            
"'',"
            
"'',"
            
"''"
            
" )");
}
?>
<center>-Редактор Охоты <?= $thisloc['Name']; ?>-</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"></td>
        <td class="block105">
            <?php
            $arrMobIdAll 
$mc->query("SELECT * FROM `hunt_equip` WHERE `id_loc` = '$id_loc' ORDER BY `level`")->fetch_all(MYSQLI_ASSOC);
            for (
$i 0$i count($arrMobIdAll); $i++) {
                
$mob $mc->query("SELECT * FROM `hunt` WHERE `id` = '" $arrMobIdAll[$i]['id_hunt'] . "'")->fetch_array(MYSQLI_ASSOC);
                
?>
                <table style="width: 100%;margin: auto;">
                    <tr>
                        <td style="width: 30px;text-align: center"><?= $i 1?></td>
                        <td style="max-width: 100%;text-align: left">
                            <?php if($mob['quests']==1){?>
                            <img src="/img/quest.png?136.2231" alt="">
                            <?php ?>
                            <img height=15 src="/img/icon/mob/<?= $mob['iconid']; ?>.png" width=15>
                            <?= $mob['name'] . '[' $mob['level'] . ']id:' $arrMobIdAll[$i]['id_hunt']; ?>
                            <a onclick="showContent('/admin/hunt.php?mob=edit&id=<?= $arrMobIdAll[$i]['id_hunt']; ?>')" style="text-decoration: underline;">
                                Изменить
                            </a>
                        </td>
                        <td style="width: 60px;">
                            <button onclick="showContent('/admin/hunt_equip/edit.php?id_loc=<?= $id_loc?>&delete=<?= $arrMobIdAll[$i]['id']; ?>')" class="button" style="width:100%;text-align: center" >Убрать</button>
                        </td>
                    </tr>
                </table>
                <hr class="hr_01"/>
                <?php
            
}
            
?>
        </td>
        <td class="block106"></td>
    </tr>
    <tr>
        <td class="block107"></td>
        <td class="block108"></td>
        <td class="block109"></td>
    </tr>
</table>
<table style="width: 100%;margin: auto;">
    <tr>
        <td style="width: 50px;">
            <input class='id_monster' type='number' value="0" style='width: 98%;height: 40px;'>
        </td>
        <td style="max-width: 100%;">
            <input onkeyup="search(this.value)" class='name_monster' type='text' style='width: 98%;height: 40px;'>
        </td>
        <td style="width: 50px;text-align: center;">
            <button onclick="add();" class="button" style="width:100%;height: 40px;text-align: center" >Добавить</button>
        </td>
    </tr>
</table>
<div class="search">

</div>
<script>
    function add() {
        showContent('/admin/hunt_equip/edit.php?id_loc=<?= $id_loc?>&add=' + $(".id_monster").val());
    }
    function add2(a) {
        showContent('/admin/hunt_equip/edit.php?id_loc=<?= $id_loc?>&add=' + a);
    }
    function search(etext) {
        var arr;
        $.ajax({
            type: "POST",
            url: "/admin/hunt_equip/search.php?etext=" + etext,
            dataType: "text",
            success: function (data) {
                $(".search").html("");
                if (data != "") {
                    arr = JSON.parse(data);
                    for (var i = 0; i < arr.length; i++) {
                        addMonsterSearched(arr[i].name, arr[i].level, arr[i].id);
                    }
                }
            },
            error: function () {
                $(".search").html("error");
            }
        });
    }
    function addMonsterSearched(name, level, id) {
        $(".search").append(
                '<table style="width: 100%;margin: auto;"><tr><td style="max-width: 100%;text-align: center;">' +
                name + ' [' + level + '] id : ' + id +
                '</td><td style="width: 50px;text-align: center;">' +
                '<button onclick="add2(' + id + ');" class="button" style="width:100%;height: 40px;text-align: center" >Добавить</button></td></tr></table>'
                );
    }
</script>
Онлайн: 3
Реклама