<?php

if (!empty($_GET['del']) && is_numeric($_GET['del']))
{
	$del = abs(intval($_GET['del']));

	if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `ask_msg` WHERE `id` = '".$del."' AND `ask_id` = '".$user_id."' LIMIT 1"),0) == true)
	{
		$arr_ask = mysql_fetch_array(mysql_query("SELECT * FROM `ask_msg` WHERE `id` = '".$del."' LIMIT 1"));
		
		if (mysql_query("DELETE FROM `ask_msg` WHERE `id` = '".$del."'") == true)
		{
			if ($arr_ask['new'] == 1) mysql_query("UPDATE `ask` SET count_new=count_new-1 WHERE `user_id` = '".$user_id."'");
			else mysql_query("UPDATE `users` SET `count_ask` = '".($user['count_ask']-1)."' WHERE `id` = '".$user_id."'");
		}
	}
}


?>