You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.9 KiB
89 lines
1.9 KiB
<?php
|
|
require_once "/var/www/html/dionisio/prgdmug/F_DMUG.php";
|
|
|
|
$server= "localhost";
|
|
$port = 1030;
|
|
$hs = "DEMIURGO10-MCANET";
|
|
$user = "general";
|
|
$pass = "123456789";
|
|
error_log("Buscando productos por medio de filtros");
|
|
$pid = getmypid();
|
|
$limit = 100;
|
|
$veces_error_server = 0;
|
|
|
|
/* Crea un objeto para el manejo postgres */
|
|
$ConDMUG = new ConexDMUG( $server , $port , $hs ,$user , $pass );
|
|
|
|
$ConDMUG->SetProgram( "BuscaPil" );
|
|
|
|
$v_campo =" ";
|
|
$v_operador = " ";
|
|
$v_valor = " ";
|
|
|
|
// $fp = fopen('archivo_busquedas.txt', 'w');
|
|
|
|
//fwrite($fp, var_dump($_POST));
|
|
|
|
|
|
foreach($_POST as $numb => $json_data)
|
|
{
|
|
foreach ($json_data as $key => $value)
|
|
{
|
|
if ($key=="campo"){
|
|
$v_campo=$value;
|
|
}
|
|
if ($key=="operador"){
|
|
$v_operador=$value;
|
|
}
|
|
if ($key=="valor"){
|
|
$v_valor=$value;
|
|
}
|
|
$operacion = $v_operador."|".$v_valor;
|
|
$operacion2 = $v_operador."|".$v_valor."\n";
|
|
|
|
}
|
|
// error_log($v_campo." ".$operacion2);
|
|
// fwrite($fp, $operacion2);
|
|
$ConDMUG->SetParameter( $v_campo , $operacion );
|
|
$ConDMUG->SetParameter( $v_campo , $operacion );
|
|
}
|
|
// fclose($fp);
|
|
|
|
if ( $ConDMUG->Execute_DMUG() < 0)
|
|
{
|
|
$veces_error_server++;
|
|
if ( $veces_error_server > 2 )
|
|
{
|
|
exit();
|
|
}
|
|
sleep(3);
|
|
continue;
|
|
}
|
|
error_log("XML: " . $ConDMUG->xmlraw);
|
|
$RESULTADO = $ConDMUG->GetChild( "STRERROR" );
|
|
echo json_encode($ConDMUG->xmlrequest);
|
|
$ConDMUG->CloseConex();
|
|
exit();
|
|
|
|
/* EJEMPLO DE JSON RECIBIDO POR busqueda.php
|
|
{
|
|
"0": {
|
|
"campo": "alcohol",
|
|
"operador": "==",
|
|
"valor": "5"
|
|
},
|
|
"1": {
|
|
"campo": "ph",
|
|
"operador": ">",
|
|
"valor": "4"
|
|
},
|
|
"2": {
|
|
"campo": "azucar",
|
|
"operador": ">",
|
|
"valor": "3"
|
|
}
|
|
}
|
|
*/
|
|
|
|
|
|
?>
|