<?

if (!isset($_GET['mess']))
{
header("Location: mail.php?".SID."&act=out");
exit;
}

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

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

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

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