diff --git a/funciones/funciones.php b/funciones/funciones.php index 381e3f7..32ae1ad 100644 --- a/funciones/funciones.php +++ b/funciones/funciones.php @@ -12856,18 +12856,30 @@ function imprime_geojson($id,$id2,$plantilla,$busqueda,$item){ $geometria =""; $or_2 =""; $w_id2=""; + $tabla = 'form_datos'; + if($tabla =='form_datos' ){ + $vista = "form_".$id_form; + $vista = existe_tabla("$vista") ; + if($vista =='1'){$tabla="form_$id_form";}else{$tabla="form_datos";} + + } + if($busqueda !="") { $busqueda = explode(':',$busqueda); if($busqueda[1] !="") { $busqueda[1] = htmlentities($busqueda[1]); - $consulta = "SELECT form_id as id, control, timestamp, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data FROM `form_datos` WHERE (form_id = '$id_form' $w_id2 AND id_campo ='$busqueda[0]' AND contenido COLLATE utf8_spanish2_ci like '%$busqueda[1]%' ) group by control ORDER BY orden desc"; + + + $consulta = "SELECT form_id as id, control, timestamp, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data + FROM $tabla + WHERE (form_id = '$id_form' $w_id2 AND id_campo ='$busqueda[0]' AND contenido COLLATE utf8_spanish2_ci like '%$busqueda[1]%' ) group by control ORDER BY orden desc"; } } elseif($item !=""){ $consulta = "SELECT form_id as id, control, timestamp, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data -FROM `form_datos` +FROM $tabla WHERE control= '$item' limit 1"; } @@ -12875,7 +12887,7 @@ limit 1"; else{ $consulta = "SELECT form_id as id, control, timestamp , GROUP_CONCAT(contenido ORDER by timestamp desc ) as data -FROM `form_datos` +FROM $tabla WHERE (form_id = '$id_form' $w_id2 ) AND ( id_campo ='$id_campo' $or_2 ) group by control @@ -12883,14 +12895,14 @@ ORDER BY orden desc"; } if($id_form2 !=""){$w_id2 =" OR form_id = '$id_form2'"; $or_2 ="or id_campo = '$id_campo2'";} - +//return $consulta ; $link=Conectarse(); //return $consulta; mysqli_set_charset($link, "utf8"); - $sql = mysqli_query($link,$consulta) or die("Error al ejecutar consulta 05 "); + $sql = mysqli_query($link,$consulta) or die("Error al ejecutar consulta 05 $consulta "); $cantidad = mysqli_num_rows($sql); if (mysqli_num_rows($sql)!='0'){ @@ -15059,7 +15071,7 @@ $fecha = date ( "Y-m-d h:i:s" , $timestamp); $empresa = remplacetas("form_id","id","$id","id_empresa",""); if(isset($_SESSION['id_empresa'])){$id_empresa = $_SESSION['id_empresa'];}else{ $id_empresa='';} if($publico[0] == 0 AND ( $id_empresa != $empresa[0])) { - $autorizado='0'; + $autorizado='0'; } /// privacidad del formulario @@ -15593,10 +15605,34 @@ $respuesta->addAssign($div,"innerHTML",$resultado); return $respuesta; } $xajax->registerFunction("matriz_formulario"); +function existe_tabla($tabla){ + $nombre_fichero = "includes/datos.php"; + if (file_exists($nombre_fichero)) { + @include("$nombre_fichero"); +}else{ @include("app/$nombre_fichero"); } + $link = Conectarse(); + $consulta = " + SELECT * + FROM information_schema.tables + WHERE table_schema = '$db' + AND table_name = '$tabla' + "; +$sql=mysqli_query($link,$consulta); +return mysqli_num_rows($sql); + +//return $consulta; + + } function remplacetas($tabla,$campo,$valor,$por,$and){ /// depende de la funcion mysqli_result por compatibilidad hacia atras +if($tabla =='form_datos' and $campo=='form_id'){ +$vista = "form_".$valor; +$vista = existe_tabla("$vista") ; +if($vista =='1'){$tabla="form_$valor";}else{$tabla="form_datos";} + +} $link=Conectarse(); mysqli_set_charset($link, "utf8"); if(@$and !=''){$AND = "AND $and";}else{$AND ="";} diff --git a/images/secure/index.php b/images/secure/index.php index bef9653..ff793c2 100644 --- a/images/secure/index.php +++ b/images/secure/index.php @@ -40,12 +40,13 @@ if (strpos($ref,'https://')===0 || strpos($ref,'https')!==0){ } $stat=stat($file); header('Content-Type: '.$mime[substr($file,-3)]); - header('Content-Length: '.$stat[7]); +// header('Content-Length: '.$stat[7]); header('Last-Modified: '.gmdate('D, d M Y H:i:s',$stat[9]).' GMT'); - readfile($file); + @readfile($file); + exit(); } header('Pragma: no-cache'); header('Cache-Control: no-cache, no-store, must-revalidate'); -include($file.'.php'); +//include($file.'.php'); ?>