<?php
/**
 * Created by PhpStorm.
 * User: Joseg
 * Date: 9/7/2018
 * Time: 8:37 PM
 */

include '../comun/validarSesion.php';

if (isset($_REQUEST['token'])) {
    $Valido = new validator();
    if (isset($_REQUEST['token']) && isset($_REQUEST['id_caseta'])) {
        if ($Valido->checkToken($_REQUEST['token'])) {
            $creadoPor = $Valido->retornarIdToken($_REQUEST['token']);
            $condominioData = $Valido->retornarDatos($creadoPor);
            $caseta = $_REQUEST['id_caseta'];
            $casetas = R::findOne('casetavigilancia', 'id = ?', [$caseta]);
            include '../comun/mensajeOk.php';
            if ($casetas) {
                print_r(json_encode($casetas));
            } else {
                include '../comun/mensajeNoHayDatosParaMostrar.php';
            }
        }
    }else{
        include '../comun/mensajeFaltanCampos.php';
    }
}else{
    include '../comun/mensajeSesionInvalida.php';
}