예제 #1
0
include '../BD.php';
include 'classes/modelo.class.php';
//LOGS: INSERT INTO `db155458_dejusticia`.`_logs` (`id`, `id_user`, `time`, `table_name`, `id_registry`, `action`) VALUES ('', '2', 'CURRENT_TIMESTAMP', '2', '2', '2');
function getCurrentURL()
{
    $currentURL = @$_SERVER["HTTPS"] == "on" ? "https://" : "http://";
    $currentURL .= $_SERVER["SERVER_NAME"];
    if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
        $currentURL .= ":" . $_SERVER["SERVER_PORT"];
    }
    $currentURL .= $_SERVER["REQUEST_URI"];
    return $currentURL;
}
$objetoModelo = new Modelo();
$objetoModelo->abrirLog();
$mensajeControlador = json_decode(file_get_contents("php://input"));
$accion = $mensajeControlador->accion;
$id_user = $mensajeControlador->id_user;
$objetoModelo->escribirLog(" Accion ..." . $accion . ".....usuario[{$id_user}] ");
if (strcmp("crear", $accion) == 0) {
    $nombreTabla = $mensajeControlador->modelo;
    $formulario = $mensajeControlador->formulario;
    $datos = array();
    $datosJSON = array();
    foreach ($formulario as $key => $value) {
        $posicion = strpos($key, 's2');
        if ($posicion !== -1 && $posicion !== FALSE) {
            // s2
        } else {
            if (strpos($key, 'file') !== 0) {