Вход Регистрация
Файл: public_html/modules/share/add_screen.php
Строк: 52
<?php
/**********************************
*    @package: PerfCMS              *
*    @year: 2012                      *
*    @author: Artas                  *
*    @link: http://perfcms.net     *
* ------------------------------- *
*    @package: PerfCMS Ultra          *
*    @year: 2013                      *
*   @author: wanya26ua & Tesla    *
*   @link: http://perfclub.ru     *
**********************************/
$locate 'in_share';
if(!isset(
$user) || 
    !isset(
$_GET['file_id']) || 
    
$db->query("SELECT * FROM `share_files` WHERE `id` = '"abs(intval($_GET['file_id'])) ."'")->rowCount() == ||
    
$db->query("SELECT `user_id` FROM `share_files` WHERE `id` = '"abs(intval($_GET['file_id'])) ."'")->fetchColumn() != $user['id'] || $user['level'] < 4
{
    
header('location: /');
    exit;
}

$file $db->query("SELECT * FROM `share_files` WHERE `id` = '"abs(intval($_GET['file_id'])) ."'")->fetch();
if(isset(
$_GET['act']) && $_GET['act'] == 'upload'
{
    if(
$_FILES['screen']['tmp_name']) 
    {
        
$screenp pathinfo($_FILES['screen']['name']);
        
$screen_dir ROOT .'/files/preview/';
        if (!
in_array($screenp['extension'], explode(';'$system['files_types']))) 
        { 
            
header('location: /share/file/'$file['id']);
            exit; 
        }
        
move_uploaded_file($_FILES['screen']['tmp_name'], $screen_dir $file['path_name'] .'.png');
        
header('location: /share/file/'$file['id']);
        exit;
    }
}
$title $lang->word('screenshot_add');
require_once(
SYS.'/view/header.php');
$tpl->div('title'$lang->word('screenshot_add'));
echo 
'<div class="menu">
        <form action="/share/add_screen?file_id='
.$file['id'].'&amp;act=upload" method="post" enctype="multipart/form-data">
            '
.$lang->word('screenshot').':<br/>
            <input type="file" name="screen" /><br/>
            <input type="submit" value="'
$lang->word('upload') .'" />
        </form>
    </div>'
;
echo 
'<div class="block">
        '
.NAV.' <a href="/share/file/'$file['id'] .'">'$lang->word('back').'</a><br/>
        '
.img('share.png').' <a href="/share">'$lang->word('share').'</a><br/>
        '
.img('home.png').' <a href="/">'$lang->word('home').'</a><br/>
    </div>'
;
require_once(
SYS.'/view/footer.php');
?>
Онлайн: 3
Реклама