<?php
/**
 * Created by PhpStorm.
 * User: Joseg
 * Date: 4/6/2018
 * Time: 6:48 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"];
        $propiedades = R::findAll( 'propiedad', 'id_condominio = ?', [$condominio]);
        include '../comun/mensajeOk.php';
        print_r(json_encode($propiedades));
    }else{
        include '../comun/mensajeDatosInvalidos.php';
    }
}else{
    include '../comun/mensajeSesionInvalida.php';
}