<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;
$id = isset($_GET['id']) ? abs((int)$_GET['id']) : false;
$array = DB::$dbs->query("SELECT * FROM album_foto WHERE id = ? LIMIT 1", [$id]);
if ($array-> rowCount() == 0) {
header('location: /');
die();
}
$arr = $array -> fetch();
$title->SetTitle(' - Удаление '.$arr['name']);
$title->GetHeader();

if ($arr['user_id'] != $b['id'] && $b['level'] < 3){
header('location: /');
die();
}
DB::$dbs->query("DELETE FROM album_rating WHERE fid = ?", [$id]);
DB::$dbs->query("DELETE FROM album_comm WHERE fid = ?", [$id]);
DB::$dbs->query("DELETE FROM album_foto WHERE id = ?", [$id]);
header('location: /gallery');

$title->GetMenu();
$title->GetFooter();
?>