<?
if (DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_komm` WHERE `id_group` = '".$group['id']."' AND `id` = '".intval($_GET['dell_komms'])."'") > 0)
{
if (DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `groups_files` WHERE `id_post` = '".intval($_GET['dell_komms'])."'") > 0)
{
$query_f = DB :: $pdo -> query("SELECT * FROM `groups_files` WHERE `id_post` = '".intval($_GET['dell_komms'])."' ORDER BY `id` DESC");
while($r_f = $query_f -> fetch())
{
if (is_file("".FILES_SERVER."/groups/files/".$r_f['id'].".jpg"))
{
unlink("".FILES_SERVER."/groups/files/".$r_f['id'].".jpg");
}
DB :: $pdo -> query("DELETE FROM `groups_files` WHERE `id` = '".$r_f['id']."' LIMIT 1");
}
}
DB :: $pdo -> query("DELETE FROM `groups_komm` WHERE `id_group` = '".$group['id']."' AND `id_post` = '".intval($_GET['dell_komms'])."'");
DB :: $pdo -> query("DELETE FROM `groups_komm` WHERE `id_group` = '".$group['id']."' AND `id` = '".intval($_GET['dell_komms'])."' LIMIT 1");
}
header("Location: /groups/?group=".$group['id']."&komm=".$post['id']."");
exit;
?>