Вход Регистрация
Файл: ajax/newModal/foto/upload.php
Строк: 79
<?
if(!(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) die;

include_once 
$_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
include_once 
H.'sys/inc/start.php'
include_once 
H.'sys/inc/compress.php';
include_once 
H.'sys/inc/sess.php';
include_once 
H.'sys/inc/settings.php';
include_once 
H.'sys/inc/db_connect.php';
include_once 
H.'sys/inc/ipua.php'
include_once 
H.'sys/inc/fnc.php';
include_once 
H.'sys/inc/user.php';

// Альбом 
if (!isset($_GET['id']) && $_GET['id'] != 0)
$gallery mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id` = '" intval($_GET['id']) . "' LIMIT 1"));
else
{
    if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `name` = 'Личные фотографии' AND `id_user` = '$user[id]'"),0) == 0)
    {
        
mysql_query("INSERT INTO `gallery` (`id_user`, `name`, `time_create`, `time`, `opis`, `pass`) values('$user[id]', 'Личные фотографии', '$time', '$time', 'Мои личные фотографии :)', '')");
        
$gallery['id'] = mysql_insert_id();
        
$gallery mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$user[id]' LIMIT 1"));
    }
    else
    {
        
$gallery mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `name` = 'Личные фотографии' AND `id_user` = '$user[id]' LIMIT 1"));
    }
}

if (!
$user['id'] || !$gallery['id'])
{
    die(
'Ошибка данных о фотоальбоме');
    exit;    
}

if (
$user['id'] != $gallery['id_user'])
{
    die(
'Вы не можете загружать фотографии в чужой альбом');
    exit;    
}

?>
<script type="text/javascript" src="/ajax/newModal/foto/inc_upload/ajaxupload.3.5.js"></script>
<link rel="stylesheet" type="text/css" href="/ajax/newModal/foto/inc_upload/style.css">

<script type="text/javascript" >
$(function(){
    var btnUpload=$('#upload');
    var status=$('#status');
    new AjaxUpload(btnUpload, {
        action: '/ajax/newModal/foto/inc_upload/photo-load.php?id=<?=$gallery['id']?>',
        name: 'uploadfile',
        onSubmit: function(file, ext)
        {
            if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext)))
            { 
                // extension is not allowed 
                //status.text('Поддерживаемые форматы JPG, PNG или GIF');
                alert('Поддерживаемые форматы JPG, PNG или GIF');
                return false;
            }
            
            $('#upload').css({'display':'none'});
            $('#progress-bar-upload').css({'display':'block'});
        },
        onComplete: function(file, response){
            //On completion clear the status
            status.text('');
            //Add uploaded file to list
            if(response === "success")
            {
                $('#dcms-modal').css({'margin-top':'20px', 'height': ''});
                $('#dcms-load-photo').css({'margin-top':'80px'});
                getPhotoDcms('', '0');
            }
            else
            {
                //$('<li></li>').appendTo('#files').text('Файл не загружен ' + file).addClass('error');
                alert('Файл не загружен ' + response);
            }
            
            $('#upload').css({'display':'block'});
            $('#progress-bar-upload').css({'display':'none'});
        }
    });
    
});
</script>

<div class="dcms-modal-upload">
Друзьям будет проще узнать Вас, если Вы загрузите свою настоящую фотографию.<br />
Вы можете загрузить изображение в формате JPG, GIF или PNG.
<div class="dcms-upload-body" id="mainbody">

<div id="upload"><span>Выбрать файл<span></div><span id="status"></span>

<div id="progress-bar-upload"></div>

 <ul id="files"></ul>
 </div>

Если у Вас возникают проблемы с загрузкой, попробуйте выбрать фотографию меньшего размера.
</div>
Онлайн: 2
Реклама