<?php
include 'inc/db.php';
include 'inc/1.php';
if (!$user || !isset($_GET['id']))
{
header('Location: /aut.php');
exit();
}
$q=mysql_query("SELECT `id` FROM `friends` WHERE `id` = '".intval($_GET['id'])."' AND (`user1` = '$user[id]' OR `user2` = '$user[id]')");
if (mysql_num_rows($q)==0)
{
header('Location: /index.php');
exit();
}
mysql_query("DELETE FROM `friends` WHERE `id` = '".intval($_GET['id'])."'");
echo '<div class="msg">
Друг успешно удален.
</div>';
include 'inc/foot.php';
?>