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

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