<?php

if (!empty($_GET['del']))
{
	$del = check($_GET['del']);	

	if (in_array($del, explode("||", substr($arr_dialog['cache_photos'], 1, -1))))
	{
		$new_cache = str_replace("|".$del."|", "", $arr_dialog['cache_photos']);
		mysql_query("UPDATE `mail_dialog` SET `cache_photos` = '".$new_cache."' , count_cache=count_cache-1 WHERE `for_id` = '".$user_id."' AND `from_id` = '".$id."' LIMIT 1");
		if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/'.$del)) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/'.$del);}
		if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$del)) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$del);}
		if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/mini/'.$del)) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/mini/'.$del);}
		if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/preview/'.$del)) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/preview/'.$del);}
	}
		if ($ajax == 'yes') exit;
		else go(URL.'/mail/upload.php?id='.$id);
}

?>