Вход Регистрация
Файл: wenr.online/app/shop/cat.php
Строк: 23
<?php


if (!$user->isAuth()) {
    
redirect('/');
    exit;
}



    
$cat $db->prepare('select * from `catBag` where `id` = ?');
    
$cat -> execute([Clean :: int($_GET['id'])]);
    
$cat $cat -> fetch(PDO :: FETCH_OBJ);
            if(!isset(
$cat->id) or $cat->id == or $cat->id == 7){
                
redirect('/shop');
                exit;
            }
            

    
$all $db->prepare('select * from `shop` where `type` = ? and `status` != ? order by `price`');
    
$all -> execute([$cat->table,1]);
    
$all $all -> fetchAll();
    function 
plus($id){
        global 
$db;
        
$item $db->prepare('select * from shop where id = ?');
        
$item -> execute([$id]);
        
$item $item -> fetch(PDO :: FETCH_OBJ);
        
$type false;
        if(
$item->force 0$type .= ' +'.$item->force.' к силе '.PHP_EOL;
        if(
$item->dex 0$type .= ' +'.$item->dex.' к ловкости '.PHP_EOL;
        if(
$item->hp 0$type .= ' +'.$item->hp.' к здоровью '.PHP_EOL;
        if(
$item->max_hp 0$type .= ' +'.$item->max_hp.' к здоровью '.PHP_EOL;
        if(
$item->mana 0$type .= ' +'.$item->mana.' к мане '.PHP_EOL;
        if(
$item->mana_max 0$type .= ' +'.$item->mana_max.' к мане '.PHP_EOL;
        if(
$item->type == 'rolls'$type $item->force.' урона. Требует '.$item->mana.' <img src="/public/assets/images/mana.png">';
        return 
$type;
        
    }
    
    
    function 
type($id){
        global 
$db;
        
$item $db->prepare('select * from shop where id = ?');
        
$item -> execute([$id]);
        
$item $item -> fetch(PDO :: FETCH_OBJ);
        
$array = ['one_handed'=>'Одноручное','two_handed'=> 'Двуручное','bow'=>'Лук','crossbow'=>'Арбалет'];
        
        return 
$array[$item->skill];
        
        
        
    }
 
    
$peger = new ArrayPaginator('/shop/cat?id='.$cat->id15); 
    
$items $peger->getItems($all);

echo 
$template->render('shop.cat',
                                [
'item'  =>  $items,
                                 
'cat'  =>  $cat,
                                 
'peger'    =>  $peger
                                                            
]    
                                    );
Онлайн: 1
Реклама