<?php
$title = 'Удаление фотографии';
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/head.php');
admin(3);
$_GET['id'] = abs(intval($_GET['id']));
$query = $db->query("SELECT * FROM `products_images` WHERE `id`='".$_GET['id']."'");
if($query->num_rows==0){
	header('location:/admin/products/edit/'.$image['id_product']);
}
$image = $query->fetch_assoc();
unlink($_SERVER["DOCUMENT_ROOT"].'/files/images/products/'.$image['image']);
$db->query("DELETE FROM `products_images` WHERE `id`='".$image['id']."'");
header('location:/admin/products/edit/'.$image['id_product']);
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/foot.php');
?>