Файл: DARK WARS/dark_war/weapon_shop/my_artifacts.php
Строк: 49
<?php
include_once '../start.php';
$doc = new document();
$doc->title('Мои артефакты');
// при выборе артефактов, сперва записываем тип переданый через форму и переннапровляем в url уже с типом артефактов
// после выбераем из url тип и делем выборку из базы
if (isset($_POST['save'])) {
    $type_get = (int) $_POST['type'];
    header ("Location: my_artifacts.php?type=$type_get");
    exit;
} else {
    $type = '';
}
if (isset($_GET['type'])) {
    $type_get = (int) $_GET['type'];
    $type = " AND `type` = '$type_get'";
    if ($type_get < 1) {
        $type = '';
    }
}
////////////////////////////////////////////////////<<<<<------||||
if ($player->set_search_arte) {
    $doc->assign('method', 'post');
    $doc->assign('action', null);
    
    $options[] = array(0, 'Все артефакты', $type_get == '0');
    $options[] = array(1, 'Броня', $type_get == '1');
    $options[] = array(2, 'Шлемы', $type_get == '2');
    $options[] = array(3, 'Сапоги', $type_get == '3');
    $options[] = array(4, 'Левая рука', $type_get == '4');
    $options[] = array(5, 'Правая рука', $type_get == '5');
    $options[] = array(6, 'Плащь', $type_get == '6');
    $options[] = array(7, 'Налокотники', $type_get == '7');
    $dispatch[] = array('type' => 'select', 'name' => 'type', 'title' => 'Отбор оружия', 'options' => $options);
    
    $dispatch[] = array('type' => 'submit', 'name' => 'save', 'value' => 'Отобрать', 'br' => 0);
    
    $doc->assign('dis', $dispatch);
    $doc->display('form.tpl');
}
$pages = new pages;
$pages->posts = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_wshop_u` WHERE `id_player` = '$player->id'$type "), 0);
$pages->this_page();
$dispatch = array();
$q=mysql_query("SELECT * FROM `dark_war_wshop_u` WHERE `id_player` = '$player->id'$type
                LIMIT {$pages->my_start()}, {$pages->items_per_page}");        
while ($post = mysql_fetch_array($q)) {
    $action = array();
    if ($post['type'] == 4) {
        $lr_type = ' - Левая';
    } elseif ($post['type'] == 5) {
        $lr_type = ' - Правая';    
    } else {
        $lr_type = '';    
    }
    $list = $post['name'] . $lr_type;
    $img = '/dark_war/all_img/weapon_shop/'.$post['type'].'/'.$post['img'].'.png';
    $link = "/dark_war/weapon_shop/my_info.php?id=" . $post['id'] . "".(isset($_GET['page'])?'&page='.$_GET['page'].'' : '')."";
    $descrip = $post['description'];
    $action[] = array('link' => 'take.php?id='.$post['id'].'', 'name' => 'Взять');
    if ($post['active'] == 1) {
        $action[] = array('link' => 'take_off.php?id='.$post['id'].'', 'name' => 'Снять');
    }
    $action[] = array('link' => "sell.php?id=".$post['id']."".(isset($_GET['page'])?'&page='.$_GET['page'].'' : '')."", 'name' => 'Продать');
    $dispatch[] = array ('title' => $list, 'img' => $img, 'link' => $link, 'descrip' => $descrip, 'action' => $action);
}
if (!$dispatch) {
    $dispatch[] = array ('title' => 'У вас нет артефактов');
}
$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
$pages->listing("my_artifacts.php".(isset($_GET['type'])?'?type='.$_GET['type'].'&' : '?').""); // вывод страниц
$doc->ret('/dark_war/my_profil.php', 'Персонаж'); // выводит ссылки шаги на зад
?>