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

if(isset($_POST['usr']) && isset($_POST['last'])){
if(!empty($_POST['usr']) && !empty($_POST['last'])){
$usr = intval($_POST['usr']);
$last = $_POST['last'];
$last = str_replace('m_', '', $last);
$last = intval($last);
$islast = mysqli_num_rows(mysqli_query($connect_db, "SELECT id FROM ".DB_PREFIX."_messages WHERE ((`fr` = '$u_id' AND `tou` = '$usr') OR (`fr` = '$usr' AND `tou` = '$u_id')) AND id > '$last' ORDER BY id DESC LIMIT 1"));
if ($islast > 0) { exit('1'); } else { exit('0'); }
} else { exit('wu-error'); }
} else { exit('wu-error'); }
?>