Файл: mail/handler/del_msg.php
Строк: 19
<?php
if (!empty($_GET['del']) && is_numeric($_GET['del'])) // Видалення повідомлення
{
$del = abs(intval($_GET['del']));
$result = mysql_query("SELECT * FROM `mail_msg` WHERE `id` = '".$del."' AND `for_id` = '".$user_id."' AND `from_id` = '".$id."' AND `del` != '".$user_id."' OR `id` = '".$del."' AND `from_id` = '".$user_id."' AND `for_id` = '".$id."' AND `del` != '".$user_id."' LIMIT 1");
if (mysql_num_rows($result) == false) go(URL.'/mail/?id='.$id);
$arr_msg = mysql_fetch_array(mysql_query("SELECT * FROM `mail_msg` WHERE `id` = '".$del."' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(`id`) FROM `mail_msg` WHERE `from_id` = '".$id."' AND `for_id` = '".$user_id."' AND `del` != '".$user_id."' OR `for_id` = '".$id."' AND `from_id` = '".$user_id."' AND `del` != '".$user_id."'"),0) > 1)
{
if ($arr_msg['del'] == $id)
{
mysql_query("DELETE FROM `mail_msg` WHERE `id` = '".$del."'");
if (!empty($arr_msg['photos']))
{
$q = explode("||", substr($arr_msg['photos'], 1, -1));
$count = count($q);
for ($i = 0; $i < $count; $i++)
{
if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/'.$q[$i])) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/'.$q[$i]);}
if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$q[$i])) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/icons/'.$q[$i]);}
if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/mini/'.$q[$i])) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/mini/'.$q[$i]);}
if (file_exists(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/preview/'.$q[$i])) {@unlink(HOME .'/files/mail/'.$arr_dialog['dir'].'/photos/preview/'.$q[$i]);}
}
}
}
else mysql_query("UPDATE `mail_msg` SET `del` = '".$user_id."' WHERE `id` = '".$del."'");
}
else go(URL.'/mail/del.php?id='.$id);
}
?>