Вход Регистрация
Файл: plugins/attachment_files.php
Строк: 202
<?
include_once '../../sys/inc/start.php';
include_once 
'../../sys/inc/compress.php';
include_once 
'../../sys/inc/sess.php';
include_once 
'../../sys/inc/home.php';
include_once 
'../../sys/inc/settings.php';
include_once 
'../../sys/inc/db_connect.php';
include_once 
'../../sys/inc/ipua.php';
include_once 
'../../sys/inc/fnc.php';
include_once 
'../../sys/inc/user.php';
/* Бан пользователя */ 
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'notes' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
header('Location: /ban.php?'.SID);exit;
}
only_reg();
$set['title']='Дневники';
include_once 
'../../sys/inc/thead.php';
title();
aut();

if (isset(
$_GET['act']) && $_GET['act']=='err'){echo "<div class='err'>Готово</div>";}

$notes=mysql_fetch_array(mysql_query("select * from `notes` where `id` = '".intval($_GET['id'])."'"));

if (isset(
$user) && (user_access('notes_delete') || $user['id']==$avtor['id'])){

if (isset(
$_FILES['file1']))
{
if (
eregi('.jpe?g$',$_FILES['file1']['name']) && $imgc=@imagecreatefromjpeg($_FILES['file1']['tmp_name']))
{
if (
imagesx($imgc)>828 || imagesy($imgc)>828)
{
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if (
$img_x==$img_y)
{
$dstW=828// ширина
$dstH=828// высота 
}
elseif (
$img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=828;
$dstH=ceil($dstW/$prop);
}
else
{
$prop=$img_y/$img_x;
$dstH=828;
$dstW=ceil($dstH/$prop);
}

$screen=imagecreatetruecolor($dstW$dstH);
imagecopyresampled($screen$imgc0000$dstW$dstH$img_x$img_y);
imagedestroy($imgc);

imagejpeg($screen,H."plugins/notes/attachments/$notes[id]_1.jpg",100);
@
chmod(H."plugins/notes/attachments/$notes[id]_1.jpg",0777);
imagedestroy($screen);
}
else
{
copy($_FILES['file1']['tmp_name'], H."plugins/notes/attachments/$notes[id]_1.jpg");
}
}
}

if (isset(
$_FILES['file2']))
{
if (
eregi('.jpe?g$',$_FILES['file2']['name']) && $imgc=@imagecreatefromjpeg($_FILES['file2']['tmp_name']))
{
if (
imagesx($imgc)>828 || imagesy($imgc)>828)
{
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if (
$img_x==$img_y)
{
$dstW=828// ширина
$dstH=828// высота 
}
elseif (
$img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=828;
$dstH=ceil($dstW/$prop);
}
else
{
$prop=$img_y/$img_x;
$dstH=828;
$dstW=ceil($dstH/$prop);
}

$screen=imagecreatetruecolor($dstW$dstH);
imagecopyresampled($screen$imgc0000$dstW$dstH$img_x$img_y);
imagedestroy($imgc);

imagejpeg($screen,H."plugins/notes/attachments/$notes[id]_2.jpg",100);
@
chmod(H."plugins/notes/attachments/$notes[id]_2.jpg",0777);
imagedestroy($screen);
}
else
{
copy($_FILES['file2']['tmp_name'], H."plugins/notes/attachments/$notes[id]_2.jpg");
}
}
}

if (isset(
$_FILES['file3']))
{
if (
eregi('.jpe?g$',$_FILES['file3']['name']) && $imgc=@imagecreatefromjpeg($_FILES['file3']['tmp_name']))
{
if (
imagesx($imgc)>828 || imagesy($imgc)>828)
{
$img_x=imagesx($imgc);
$img_y=imagesy($imgc);
if (
$img_x==$img_y)
{
$dstW=828// ширина
$dstH=828// высота 
}
elseif (
$img_x>$img_y)
{
$prop=$img_x/$img_y;
$dstW=828;
$dstH=ceil($dstW/$prop);
}
else
{
$prop=$img_y/$img_x;
$dstH=828;
$dstW=ceil($dstH/$prop);
}

$screen=imagecreatetruecolor($dstW$dstH);
imagecopyresampled($screen$imgc0000$dstW$dstH$img_x$img_y);
imagedestroy($imgc);

imagejpeg($screen,H."plugins/notes/attachments/$notes[id]_3.jpg",100);
@
chmod(H."plugins/notes/attachments/$notes[id]_3.jpg",0777);
imagedestroy($screen);
}
else
{
copy($_FILES['file3']['tmp_name'], H."plugins/notes/attachments/$notes[id]_3.jpg");
}
}
}








echo 
"<form method='post' enctype='multipart/form-data' action='?id=$notes[id]&act=err'>n";

if (
is_file(H.'/plugins/notes/attachments/$notes[id]_1.jpg')) {
echo 
"<img src='/plugins/notes/attachments/$notes[id]_1.jpg' width='95'/><br/>n";
    }

echo 
"<input type='file' name='file1' accept='image/jpeg' /><br/>n";

if (
is_file(H.'/plugins/notes/attachments/$notes[id]_2.jpg')) {
echo 
"<img src='/plugins/notes/attachments/$notes[id]_2.jpg' width='95'/><br/>n";
    }

echo 
"<input type='file' name='file2' accept='image/jpeg' /><br/>n";

if (
is_file(H.'/plugins/notes/attachments/$notes[id]_3.jpg')) {
echo 
"<img src='/plugins/notes/attachments/$notes[id]_3.jpg' width='95'/><br/>n";
    }


echo 
"<input type='file' name='file3' accept='image/jpeg' /><br/>n";

echo 
"<input value='Загрузить изображения' type='submit' /><br />n";
echo 
"</form>n";

echo 
"<a href='/plugins/notes/attachments/$notes[id]_1.jpg'><img src='/plugins/notes/attachments/$notes[id]_1.jpg' width='95'/></a>|<a href='/plugins/notes/attachment_files.php?id=$notes[id]&act=1'>x</a>";

echo 
"<a href='/plugins/notes/attachments/$notes[id]_2.jpg'><img src='/plugins/notes/attachments/$notes[id]_2.jpg' width='95'/></a>|<a href='/plugins/notes/attachment_files.php?id=$notes[id]&act=2'>x</a>";

echo 
"<a href='/plugins/notes/attachments/$notes[id]_3.jpg'><img src='/plugins/notes/attachments/$notes[id]_3.jpg' width='95'/></a>|<a href='/plugins/notes/attachment_files.php?id=$notes[id]&act=3'>x</a>";


if (isset(
$_GET['act']) && $_GET['act']=='1'){
@
unlink(H."/plugins/notes/attachments/$notes[id]_1.jpg");
}
if (isset(
$_GET['act']) && $_GET['act']=='2'){
@
unlink(H."/plugins/notes/attachments/$notes[id]_2.jpg");
}
if (isset(
$_GET['act']) && $_GET['act']=='3'){
@
unlink(H."/plugins/notes/attachments/$notes[id]_3.jpg");
}
}else{
echo 
"Нельзя";}
include_once 
'../../sys/inc/tfoot.php';
?>
Онлайн: 0
Реклама