Файл: Dvig/add.php
Строк: 38
<?php
####################
## Автор - USER-X ##
## Copyright 2013 ##
## xcms.mcdir.ru  ##
####################
        define( 'xcms_pro', 1 ) ;
        set_time_limit( 0 ) ;
        $path = '' ;
        include_once ( $path . 'core/core.php' ) ;
        #########
        if ( $act )
        {
                        if(!$users['level'] >= '4')
                        {
                                        $_SESSION['error'] = 'Для создания новости нужно быть в составе администрации!<br/>' ;
                                        header( "location: ../index.php" ) ;
                                        include_once ( $path . 'core/foot.php' ) ;
                                        exit ;
                        }
                        include_once ( $path . 'core/upl.php' ) ;
                        $name = isset( $_POST['name'] ) ? trim( $_POST['name'] ) : '' ;
                        if ( empty( $name ) )
                        {
                                        $_SESSION['error'] = 'Пожалуйста,введите название!<br/>' ;
                                        header( "location: ?" ) ;
                                        exit ;
                        }
                        #############################
                        $name = check($_POST['name']);
                        $text = check($_POST['text']);
                        $time=time();
                        mysql_query( "INSERT INTO `news` SET 
        `name` = '$name',
        `text` = '$text',
        `time` = '$time',
        `whoid` = '$users[id]',
        `whona` = '$users[login]',
        `poleb` = '0'
        " ) ;
                        header('location: /news') ;
                        exit ;
        }
        #########
        $title = 'Создание новости' ;
        include_once ( $path . 'core/head.php' ) ;
        #########
        if($users['level'] >='4'){
        echo '<div id="razd">'.$title.'</div><div id="body">' ;
        echo '<form action="?act=ok" method="post" enctype="multipart/form-data"> 
    Название:<small>(max:45)</small><br/><input type="text" name="name" value="" maxlength="45"/><br/>
    Текст:<small>(max:500)</small><br/><input type="text" name="text" value="" maxlength="500"/><br/>
      <input type="submit" value="Добавить"/><br/>
         </form>' ;
        echo '</div>' ;
        }else{echo'<div id="error">Вы не администратор</div>';}
        #########
        include_once ( $path . 'core/foot.php' ) ;
?>