File size: 2.9Kb
<?
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';
user_access('adm_news',null,'index.php?'.SID);
define ('id', isset( $_GET['id'] ) ? abs(intval($_GET['id'])) : 0);
define ('ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
$act = mysql_fetch_assoc(mysql_query("SELECT * FROM `news` WHERE `id` = '".id."' LIMIT 1"));
$title = htmlspecialchars($act['title']);
// проверяем существует запись
if (!empty($act)) {
// проверяем наличие фото
if ($act['file'] == null){
$_SESSION['message'] = 'Ошибка фото не добавлено';
header ("Location: /news/news/?id=".$act['id']."" . SID);
exit;
}
// загрузка
if (isset($_POST['upload'])) {
mysql_query("UPDATE `news` SET `file` = '' WHERE `id` = '$act[id]' LIMIT 1");
@unlink(ROOT."news/photo/img/".$act['file']."");
$_SESSION['message'] = 'Фото удалено';
header ("Location: /news/news/?id=".$act['id']."" . SID);
exit;
}
// заголовок страницы
$set['title'] = 'Новости : Удаление фото';
// head
include_once '../../sys/inc/thead.php';
title();
aut();
err();
echo'
<link rel="stylesheet" href="/news/style.css" type="text/css">
<div class="main_bg">
<div class="lc_br wbg font0 relative oh" id="header_path">
<a href="/" style="font-size:0;"> <img src="/news/ico/home.png" alt=""> </a>
<span class="lc_brw">
<img src="/news/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">
<a href="/news/">Новости</a></span>
<span class="lc_brw">
<img src="/news/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">
<a href="/news/news/?id='.$act['id'].'">'.$title.'</a></span>
<span class="lc_brw">
<img src="/news/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">
Удаление фото</span></span>
</div></div>
<form method="post" enctype="multipart/form-data">
<div class="wrapper">
<div class="block">
<div>
<div class="grey" style ="margin-bottom: 6px;">Удаление фото с записи: <span style ="color: #000;">'.$title.'</span> </div>
</div>
</div></div>
<table class="table__wrap">
<tbody><tr> <td>
<div class="wrapper mt_0 mr0">
<button name="upload" class=" link blue full is_final " style = "color: #ff0c0c!important;">
<img src="/news/ico/delete.png " alt="" class="m">
<span class="m">Удалить</span>
</button>
</div></td> </tr>
</tbody></table>
</form>
';
}else{$_SESSION['message'] = 'Ошибка запись не найдена'; header("location: /news/");}
include_once '../../sys/inc/tfoot.php';
?>