Файл: vsime.com/friends/inc/act_delete.php
Строк: 28
<?
@$ank = profile(intval($_GET['id']));
if_user('is_reg');
$page = 1;
if (isset($_GET['page']))$page = intval($_GET['page']);
if (!$ank['id']) {
$title .= ' - Ошибка!';
ex_head();
show_errors('Пользователь не найден.');
ex_foot();
}
if (!mysqli_result("SELECT COUNT(*) FROM `friends` WHERE ((`id_user` = '$user[id]' AND `id_ank` = '$ank[id]') OR (`id_user` = '$ank[id]' AND `id_ank` = '$user[id]')) AND `ok` = '1'")) {
$title .= ' - Ошибка!';
ex_head();
show_errors("Пользователь ".profile_nick($ank['id'], 1)." не является Вашим другом.");
ex_foot();
}
if (mysqli_result("SELECT COUNT(*) FROM `readers` WHERE `id_user` = '$user[id]' AND `id_ank` = '$ank[id]'")) {
mysqli_query($dbi, "DELETE FROM `readers` WHERE `id_user` = '$user[id]' AND `id_ank` = '$ank[id]'");
}
if (mysqli_result("SELECT COUNT(*) FROM `readers` WHERE `id_user` = '$ank[id]' AND `id_ank` = '$user[id]'")) {
mysqli_query($dbi, "DELETE FROM `readers` WHERE `id_user` = '$ank[id]' AND `id_ank` = '$user[id]'");
}
mysqli_query($dbi, "DELETE FROM `friends` WHERE ((`id_user` = '$user[id]' AND `id_ank` = '$ank[id]') OR (`id_user` = '$ank[id]' AND `id_ank` = '$user[id]')) AND `ok` = '1'");
msg_sess("Пользователь <b>$ank[nick]</b> удален из списка Ваших друзей.");
header("Location: ?act=user&id=$user[id]&page=$page");
exit();
?>