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