2 function delete_mail() {
3 global $node,$db,$error;
4 $user_id = $_SESSION['user_id'];
5 foreach ($_POST['message'] as $chosen =>$value) {
7 $mail_id = intval($mail_id);
11 $set = $db->query("select mail_read,mail_to from mail where mail_id = '$chosen' and mail_from = '$user_id'");
13 if ($set->getString('mail_read') == 'no') {
14 $db->query("delete from mail where mail_duplicate_id = '$chosen' and mail_from = '$user_id'");
15 $db->update("update users set user_mail = user_mail - 1 where user_id = ". $set->getString('mail_to') ."");
17 $db->query("delete from mail where mail_id = '$chosen' and mail_user = '$user_id'");