<?

if (!isset($_GET['id'])){
$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]kont` WHERE `id_user` = '$user[id]';");
if (mysql_result($q, 0)==0){header ("Location: mail.php?".SID."");exit;}
echo "<div class=\"h\">Выберите контакт</div>\n";
echo "<form method=\"get\" action=\"mail.php\">\n";
echo "<input name=\"act\" class=\"form\"  value=\"konts\" type=\"hidden\" />\n";
echo "<select class=\"form\"  name=\"id\">\n";
$q = mysql_query("SELECT * FROM `$mysql[pref]kont` WHERE `id_user` = '$user[id]';");
while ($kont = mysql_fetch_array($q)){
echo "<option value=\"$kont[id_kont]\">$kont[nick]</option>\n";}
echo "</select><br />\n";
echo "<br /><input value=\"Удалить\" class=\"form\" type=\"submit\" />\n";
echo "</form>\n";
echo "<hr />";
echo "<a href=\"mail.php\">&lt;&lt; Почта</a><br />\n";
echo "<a href=\"index.php\">&lt;&lt; На главную</a>\n";

foot();
}
$id_kont=intval($_GET['id']);

mysql_query("DELETE FROM `$mysql[pref]kont` WHERE `id_kont` = '$id_kont';");


header("Location: mail.php?".SID."&msg=kont_del");
exit;




?>
