<?php
$title = 'Удаление из карзины';
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/head.php');
$_GET['id'] = abs(intval($_GET['id']));
$query = $db->query("SELECT * FROM `cart` WHERE `id`='".$_GET['id']."'");
if($query->num_rows == 0){
	header('location:/main');
}
$cart = $query->fetch_assoc();
if($cart['id_user'] != $user['id']){
	header('location:/main');
}
$db->query("DELETE FROM `cart` WHERE `id`='".$_GET['id']."'");
header('location:/cart');
include_once($_SERVER["DOCUMENT_ROOT"].'/php/style/foot.php');
?>