Файл: mylaf.ru/mods/forum/deithem/add.img.php
Строк: 66
<?php
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';
only_reg();
$set['title']="Изображение к теме";
include_once '../../sys/inc/thead.php';
title();
aut();
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_them` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1",$db), 0)==0){
header("location:/index.php?");
}
$them=mysql_fetch_array(mysql_query("select * from `forum_them` where `id` = '".intval($_GET['id'])."'"));
if ($user['level']>2 || $user['id'] == $stat['id_user']){
if(isset($_GET['del_img']) && is_file(H.'forum/images/'.$them['id'].'.png')){
unlink(H.'forum/images/'.$them['id'].'.png');
header("location: /forum/them.php?id=$them[id]");
}
if(isset($_POST['ok'])){
if (isset($_FILES['file'])){
$type = $_FILES['file']['type'];
if ($type!=='image/jpeg' && $type!=='image/jpg' && $type!=='image/gif' && $type!=='image/png')$err='Извените но выбраное вами изображение не поддерживается. разрешено выгружать картинки форматами JPEG, JPG, GIF, PNG.';
}
if (!isset($err)){
$tmp = $_FILES['file']['tmp_name'];
unlink(H.'forum/images/'.$them['id'].'.png');
move_uploaded_file($tmp,
H.'forum/images/'.$them['id'].'.png');
chmod(H.'forum/images/'.$them['id'].'.png', 0777);
header("Location: /forum/them.php?id=$them[id]");
}
}
err();
if(is_file(H.'forum/images/'.$them['id'].'.png'))echo "<img src='/forum/images/$them[id].png' height='100'/><a href='?id=$them[id]&del_img' style='color:red'>Удалить изображение</a><br/>";
echo "<form method='post' action='add.img.php?id=$them[id]&$passgen' enctype='multipart/form-data'>";
echo "<b>Картинка:</b><br/>";
echo "<input type='file' name='file'/><br/>";
echo "<input type='submit' name='ok' value='Выгрузить'><br /></form>";
echo "<a href='/forum/deithem.php?id=$them[id]'><div class='foot'><img src='/style/icons/str2.gif' alt='!'>Вернутся к действиям</div></a>";
}
include_once '../../sys/inc/tfoot.php';
?>