Вход Регистрация
Файл: wenr.online/app/forum/new.php
Строк: 20
<?php
if (!$user->isAuth()) {
    
redirect('/');
    exit;
}

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

                 if(isset(
$_POST['name']) and $user->get()->lvl >= 6){
                    
                    
                    
$name Clean :: str($_POST['name']);
                    
$text Clean :: text($_POST['text']);
                    if(empty(
$name)){
                        
Notif :: error('Введите название обращения','/forum/new?id='.$cat->id);
                        exit;
                    }
                     if(empty(
$text)){
                         
Notif :: error('Введите текст обращения','/forum/new?id='.$cat->id);
                        exit;
                    }
                   
                     
notifSend(5,'Новый тема в разделе '.$cat->name);
                
                    
$add $db->prepare('INSERT INTO `forum_topic` (`name`,`user`,`text`,`time`,`cat`) VALUES (?,?,?,?,?)');
                    
$add->execute([$name,$user->get()->user_id,$text,time(),$cat->id]);
                    
$id $db->lastInsertId();
                    
redirect('/forum/view?id='.$id);
                    exit;
                }
                
           
            
echo 
$template->render('forum.new');
Онлайн: 1
Реклама