<?

if (!isset($_GET['mess']))
{
mysql_query("DELETE FROM `$mysql[pref]mail` WHERE `id_in_user` = '$user[id]';");
header("Location: mail.php?".SID."&act=in");
exit;
}

$mess_id=intval($_GET['mess']);

$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]mail` WHERE `id_in_user` = '$user[id]' AND `id` = '$mess_id';");
if(mysql_result($q, 0)==0){header ("Location: mail.php?".SID."&act=in");}

mysql_query("DELETE FROM `$mysql[pref]mail` WHERE `id` = '$mess_id';");

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