0

用户如何删除他发送或其他用户发送的消息?消息应仅在未删除消息的人的对话中显示。

if($action == 'delete_mess') {

    $hash=$_GET['hash'];
    $mess_id=$_GET['mess_id'];

    $mess_query=mysql_query("SELECT * FROM messages WHERE hash = '$hash'");

    while($check_mess = mysql_fetch_assoc($mess_query)) {

        $from = $check_mess['from_id'];
        $to = $check_mess['to_id'];
    }

    if ($from == $session_user_id) {

        mysql_query("UPDATE messages SET from_del = 1 WHERE `id` = '$mess_id' ");

    } else {

        mysql_query("UPDATE messages SET to_del = 1 WHERE `id` = '$mess_id' ");
    }

    header('location: messages.php?hash='.$hash);
}

哈希是开始的对话 ID。

4

0 回答 0