<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('3'); }

if(isset($_POST['id'])){
if(!empty($_POST['id'])){
$id = intval($_POST['id']);
$unu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT id,m,st FROM ".DB_PREFIX."_es_u WHERE id='$id' LIMIT 1"));
$nu = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT id,usr FROM ".DB_PREFIX."_es WHERE id='$unu[m]' LIMIT 1"));
if ($nu['usr'] != $u_id) { exit('3'); }
if ($unu['st'] == 1) { exit('0'); }
mysqli_query($connect_db, "DELETE FROM `".DB_PREFIX."_es_u` WHERE id = '$id' LIMIT 1");
exit('1');
} else { exit('3'); }
} else { exit('3'); }
?>