Вход Регистрация
Файл: Dvig/upfoto.php
Строк: 55
<?php
####################
## Автор - USER-X ##
## Copyright 2013 ##
## xcms.mcdir.ru  ##
####################
        
define'xcms_pro') ;
        
$path '' ;
        
$fotos 1;
        include_once ( 
$path 'core/core.php' ) ;
        
#########
    
if ( ! $users )
                        {
                                        
$_SESSION['error'] ='Ошибка чтения данных!<br/>' ;
                                        
header"location: index.php" ) ;
                                        exit ;
                        }
                        
        if ( isset( 
$_POST['submit'] ) )
        {
                        include_once ( 
$path 'core/upl.php' ) ;
                        
$handle = new upload$_FILES['imagefile'] ) ;
                        if ( 
$handle->uploaded )
                        {
                                        
// Обрабатываем фото
                                        
$handle->file_new_name_body $users['id'] ;
                                        
//$handle->mime_check = false;
                                        
$handle->allowed = array(
                                                        
'image/jpeg',
                                                        
'image/gif',
                                                        
'image/png' ) ;
                                        
$handle->file_max_size 1024 1000 ;
                                        
$handle->file_overwrite true ;
                                        
$handle->image_resize true ;
                                        
$handle->image_x 160 ;
                                        
$handle->image_ratio_y true ;
                                        
$handle->image_convert 'jpg' ;
                                        
$handle->process'avatar' ) ;
                                        if ( 
$handle->processed )
                                        {
                                                        
$handle->file_new_name_body $users['id'] ;
                                                        
$handle->file_overwrite true ;
                                                        
$handle->image_resize true ;
                                                        
$handle->image_x 40 ;
                                                        
$handle->image_ratio_y true ;
                                                        
$handle->image_convert 'png' ;
                                                        
$handle->process'avatar/small' ) ;
                                                        
mysql_query"UPDATE `users` SET `avatar` = '1' WHERE `id` = '$users[id]' LIMIT 1" ) ;


                                        }
                                        else
                                        {
                                                        echo 
$handle->error ;
                                        }
                                        
$handle->clean() ;

                                        
header"location: usermain.php?id=$users[id]) ;
                                        exit ;
                        }

        }
        else
        {
                        
$title 'Загрузка аватара' ;
                        include_once ( 
$path 'core/head.php' ) ;
                        
#########
          
echo'<div id="razd">'.$title.'</div><div id="body">';
                        echo 
'<b>Выгружаем аватар</b><br />' ;
                        echo 
'<form enctype="multipart/form-data" method="post" action="upfoto.php?">' ;
                        echo 
'Выберите изображение:<br /><input type="file" name="imagefile" value="" />' ;
                        echo 
'<input type="hidden" name="MAX_FILE_SIZE" value="' . ( 1024 3000 ) .
                                        
'" />' ;
                        echo 
'<input type="submit" name="submit" value="Выгрузить" />' ;
                        echo 
'</form>' ;
                        echo 
'<small>Для выгрузки разрешены файлы JPG, JPEG, PNG, GIF<br />Размер файла не должен превышать 3 мб.<br />' ;
                        echo 
'Вне зависимости от разрешения исходного файла, он будет преобразован в размер 40х40<br />' ;
                        echo
'</div>';
        }
        
#########
        
include_once ( $path 'core/foot.php' ) ;

?>
Онлайн: 0
Реклама