<?php
/**
 * Created by PhpStorm.
 * User: Joseg
 * Date: 16/7/2018
 * Time: 6:44 PM
 */
include '../comun/validarSesion.php';

if (isset($_REQUEST['token'])) {
    $Valido = new validator();
    if ($Valido->checkToken($_REQUEST['token'])){
        $creadoPor = $Valido->retornarIdToken($_REQUEST['token']);
        $condominioData = $Valido->retornarDatos($creadoPor);
        $condominio = $condominioData["condominio_id"];
        $directoriocontacto = R::findAll( 'directoriocontacto', 'id_condominio = ?', [$condominio]);
        include '../comun/mensajeOk.php';
        print_r(json_encode($directoriocontacto));
    }else{
        include '../comun/mensajeDatosInvalidos.php';
    }
}else{
    include '../comun/mensajeSesionInvalida.php';
}