include("funciones/sesion.php"); include("class/funciones_bd.php"); // if ($_SESSION["usuario"]=="" || !isset($_SESSION["usuario"])){ // die(header('/aviso-uso/')); // } $seccion = "buscador"; $ingredientes_con_1 = ""; $ingredientes_con_2 = ""; $ingredientes_con_3 = ""; $ingredientes_con_4 = ""; $ingredientes_sin_1 = ""; $ingredientes_sin_2 = ""; $ingredientes_sin_3 = ""; $ingredientes_sin_4 = ""; $sql_ingredientes = mostrar(2,"ingredientes","id,nombre","mercado_categoria=2 OR mercado_categoria=0 ORDER BY nombre"); while($row_ingredientes = mysqli_fetch_array($sql_ingredientes)){ if ($_REQUEST["con_1"] == $row_ingredientes["id"]) { $ingredientes_con_1 .= ''; } else { $ingredientes_con_1 .= ''; } if ($_REQUEST["con_2"] == $row_ingredientes["id"]) { $ingredientes_con_2 .= ''; } else { $ingredientes_con_2 .= ''; } if ($_REQUEST["con_3"] == $row_ingredientes["id"]) { $ingredientes_con_3 .= ''; } else { $ingredientes_con_3 .= ''; } if ($_REQUEST["con_4"] == $row_ingredientes["id"]) { $ingredientes_con_4 .= ''; } else { $ingredientes_con_4 .= ''; } if ($_REQUEST["sin_1"] == $row_ingredientes["id"]) { $ingredientes_sin_1 .= ''; } else { $ingredientes_sin_1 .= ''; } if ($_REQUEST["sin_2"] == $row_ingredientes["id"]) { $ingredientes_sin_2 .= ''; } else { $ingredientes_sin_2 .= ''; } if ($_REQUEST["sin_3"] == $row_ingredientes["id"]) { $ingredientes_sin_3 .= ''; } else { $ingredientes_sin_3 .= ''; } if ($_REQUEST["sin_4"] == $row_ingredientes["id"]) { $ingredientes_sin_4 .= ''; } else { $ingredientes_sin_4 .= ''; } } if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $con = ""; if ($_REQUEST["con_1"] != "0") { if ($con != "") { $con .= " AND (recetas.ingrediente_1=".$_REQUEST['con_1']." OR recetas.ingrediente_2=".$_REQUEST['con_1']." OR recetas.ingrediente_3=".$_REQUEST['con_1']." OR recetas.ingrediente_4=".$_REQUEST['con_1']." OR recetas.ingrediente_5=".$_REQUEST['con_1']." OR recetas.ingrediente_6=".$_REQUEST['con_1']." OR recetas.ingrediente_7=".$_REQUEST['con_1']." OR recetas.ingrediente_8=".$_REQUEST['con_1']." OR recetas.ingrediente_9=".$_REQUEST['con_1']." OR recetas.ingrediente_10=".$_REQUEST['con_1']." OR recetas.ingrediente_11=".$_REQUEST['con_1']." OR recetas.ingrediente_12=".$_REQUEST['con_1']." OR recetas.ingrediente_13=".$_REQUEST['con_1']." OR recetas.ingrediente_14=".$_REQUEST['con_1'].")"; } else { $con .= "(recetas.ingrediente_1=".$_REQUEST['con_1']." OR recetas.ingrediente_2=".$_REQUEST['con_1']." OR recetas.ingrediente_3=".$_REQUEST['con_1']." OR recetas.ingrediente_4=".$_REQUEST['con_1']." OR recetas.ingrediente_5=".$_REQUEST['con_1']." OR recetas.ingrediente_6=".$_REQUEST['con_1']." OR recetas.ingrediente_7=".$_REQUEST['con_1']." OR recetas.ingrediente_8=".$_REQUEST['con_1']." OR recetas.ingrediente_9=".$_REQUEST['con_1']." OR recetas.ingrediente_10=".$_REQUEST['con_1']." OR recetas.ingrediente_11=".$_REQUEST['con_1']." OR recetas.ingrediente_12=".$_REQUEST['con_1']." OR recetas.ingrediente_13=".$_REQUEST['con_1']." OR recetas.ingrediente_14=".$_REQUEST['con_1'].")"; } } if ($_REQUEST["con_2"] != "0") { if ($con != "") { $con .= " AND (recetas.ingrediente_1=".$_REQUEST['con_2']." OR recetas.ingrediente_2=".$_REQUEST['con_2']." OR recetas.ingrediente_3=".$_REQUEST['con_2']." OR recetas.ingrediente_4=".$_REQUEST['con_2']." OR recetas.ingrediente_5=".$_REQUEST['con_2']." OR recetas.ingrediente_6=".$_REQUEST['con_2']." OR recetas.ingrediente_7=".$_REQUEST['con_2']." OR recetas.ingrediente_8=".$_REQUEST['con_2']." OR recetas.ingrediente_9=".$_REQUEST['con_2']." OR recetas.ingrediente_10=".$_REQUEST['con_2']." OR recetas.ingrediente_11=".$_REQUEST['con_2']." OR recetas.ingrediente_12=".$_REQUEST['con_2']." OR recetas.ingrediente_13=".$_REQUEST['con_2']." OR recetas.ingrediente_14=".$_REQUEST['con_2'].")"; } else { $con .= "(recetas.ingrediente_1=".$_REQUEST['con_2']." OR recetas.ingrediente_2=".$_REQUEST['con_2']." OR recetas.ingrediente_3=".$_REQUEST['con_2']." OR recetas.ingrediente_4=".$_REQUEST['con_2']." OR recetas.ingrediente_5=".$_REQUEST['con_2']." OR recetas.ingrediente_6=".$_REQUEST['con_2']." OR recetas.ingrediente_7=".$_REQUEST['con_2']." OR recetas.ingrediente_8=".$_REQUEST['con_2']." OR recetas.ingrediente_9=".$_REQUEST['con_2']." OR recetas.ingrediente_10=".$_REQUEST['con_2']." OR recetas.ingrediente_11=".$_REQUEST['con_2']." OR recetas.ingrediente_12=".$_REQUEST['con_2']." OR recetas.ingrediente_13=".$_REQUEST['con_2']." OR recetas.ingrediente_14=".$_REQUEST['con_2'].")"; } } if ($_REQUEST["con_3"] != "0") { if ($con != "") { $con .= " AND (recetas.ingrediente_1=".$_REQUEST['con_3']." OR recetas.ingrediente_2=".$_REQUEST['con_3']." OR recetas.ingrediente_3=".$_REQUEST['con_3']." OR recetas.ingrediente_4=".$_REQUEST['con_3']." OR recetas.ingrediente_5=".$_REQUEST['con_3']." OR recetas.ingrediente_6=".$_REQUEST['con_3']." OR recetas.ingrediente_7=".$_REQUEST['con_3']." OR recetas.ingrediente_8=".$_REQUEST['con_3']." OR recetas.ingrediente_9=".$_REQUEST['con_3']." OR recetas.ingrediente_10=".$_REQUEST['con_3']." OR recetas.ingrediente_11=".$_REQUEST['con_3']." OR recetas.ingrediente_12=".$_REQUEST['con_3']." OR recetas.ingrediente_13=".$_REQUEST['con_3']." OR recetas.ingrediente_14=".$_REQUEST['con_3'].")"; } else { $con .= "(recetas.ingrediente_1=".$_REQUEST['con_3']." OR recetas.ingrediente_2=".$_REQUEST['con_3']." OR recetas.ingrediente_3=".$_REQUEST['con_3']." OR recetas.ingrediente_4=".$_REQUEST['con_3']." OR recetas.ingrediente_5=".$_REQUEST['con_3']." OR recetas.ingrediente_6=".$_REQUEST['con_3']." OR recetas.ingrediente_7=".$_REQUEST['con_3']." OR recetas.ingrediente_8=".$_REQUEST['con_3']." OR recetas.ingrediente_9=".$_REQUEST['con_3']." OR recetas.ingrediente_10=".$_REQUEST['con_3']." OR recetas.ingrediente_11=".$_REQUEST['con_3']." OR recetas.ingrediente_12=".$_REQUEST['con_3']." OR recetas.ingrediente_13=".$_REQUEST['con_3']." OR recetas.ingrediente_14=".$_REQUEST['con_3'].")"; } } if ($con != "") { $con .= " AND "; } $sin = ""; if ($_REQUEST["sin_1"] != "0") { if ($sin != "") { $sin .= " AND (recetas.ingrediente_1!=".$_REQUEST['sin_1']." AND recetas.ingrediente_2!=".$_REQUEST['sin_1']." AND recetas.ingrediente_3!=".$_REQUEST['sin_1']." AND recetas.ingrediente_4!=".$_REQUEST['sin_1']." AND recetas.ingrediente_5!=".$_REQUEST['sin_1']." AND recetas.ingrediente_6!=".$_REQUEST['sin_1']." AND recetas.ingrediente_7!=".$_REQUEST['sin_1']." AND recetas.ingrediente_8!=".$_REQUEST['sin_1']." AND recetas.ingrediente_9!=".$_REQUEST['sin_1']." AND recetas.ingrediente_10!=".$_REQUEST['sin_1']." AND recetas.ingrediente_11!=".$_REQUEST['sin_1']." AND recetas.ingrediente_12!=".$_REQUEST['sin_1']." AND recetas.ingrediente_13!=".$_REQUEST['sin_1']." AND recetas.ingrediente_14!=".$_REQUEST['sin_1'].")"; } else { $sin .= "(recetas.ingrediente_1!=".$_REQUEST['sin_1']." AND recetas.ingrediente_2!=".$_REQUEST['sin_1']." AND recetas.ingrediente_3!=".$_REQUEST['sin_1']." AND recetas.ingrediente_4!=".$_REQUEST['sin_1']." AND recetas.ingrediente_5!=".$_REQUEST['sin_1']." AND recetas.ingrediente_6!=".$_REQUEST['sin_1']." AND recetas.ingrediente_7!=".$_REQUEST['sin_1']." AND recetas.ingrediente_8!=".$_REQUEST['sin_1']." AND recetas.ingrediente_9!=".$_REQUEST['sin_1']." AND recetas.ingrediente_10!=".$_REQUEST['sin_1']." AND recetas.ingrediente_11!=".$_REQUEST['sin_1']." AND recetas.ingrediente_12!=".$_REQUEST['sin_1']." AND recetas.ingrediente_13!=".$_REQUEST['sin_1']." AND recetas.ingrediente_14!=".$_REQUEST['sin_1'].")"; } } if ($_REQUEST["sin_2"] != "0") { if ($sin != "") { $sin .= " AND (recetas.ingrediente_1!=".$_REQUEST['sin_2']." AND recetas.ingrediente_2!=".$_REQUEST['sin_2']." AND recetas.ingrediente_3!=".$_REQUEST['sin_2']." AND recetas.ingrediente_4!=".$_REQUEST['sin_2']." AND recetas.ingrediente_5!=".$_REQUEST['sin_2']." AND recetas.ingrediente_6!=".$_REQUEST['sin_2']." AND recetas.ingrediente_7!=".$_REQUEST['sin_2']." AND recetas.ingrediente_8!=".$_REQUEST['sin_2']." AND recetas.ingrediente_9!=".$_REQUEST['sin_2']." AND recetas.ingrediente_10!=".$_REQUEST['sin_2']." AND recetas.ingrediente_11!=".$_REQUEST['sin_2']." AND recetas.ingrediente_12!=".$_REQUEST['sin_2']." AND recetas.ingrediente_13!=".$_REQUEST['sin_2']." AND recetas.ingrediente_14!=".$_REQUEST['sin_2'].")"; } else { $sin .= "(recetas.ingrediente_1!=".$_REQUEST['sin_2']." AND recetas.ingrediente_2!=".$_REQUEST['sin_2']." AND recetas.ingrediente_3!=".$_REQUEST['sin_2']." AND recetas.ingrediente_4!=".$_REQUEST['sin_2']." AND recetas.ingrediente_5!=".$_REQUEST['sin_2']." AND recetas.ingrediente_6!=".$_REQUEST['sin_2']." AND recetas.ingrediente_7!=".$_REQUEST['sin_2']." AND recetas.ingrediente_8!=".$_REQUEST['sin_2']." AND recetas.ingrediente_9!=".$_REQUEST['sin_2']." AND recetas.ingrediente_10!=".$_REQUEST['sin_2']." AND recetas.ingrediente_11!=".$_REQUEST['sin_2']." AND recetas.ingrediente_12!=".$_REQUEST['sin_2']." AND recetas.ingrediente_13!=".$_REQUEST['sin_2']." AND recetas.ingrediente_14!=".$_REQUEST['sin_2'].")"; } } if ($_REQUEST["sin_3"] != "0") { if ($sin != "") { $sin .= " AND (recetas.ingrediente_1!=".$_REQUEST['sin_3']." AND recetas.ingrediente_2!=".$_REQUEST['sin_3']." AND recetas.ingrediente_3!=".$_REQUEST['sin_3']." AND recetas.ingrediente_4!=".$_REQUEST['sin_3']." AND recetas.ingrediente_5!=".$_REQUEST['sin_3']." AND recetas.ingrediente_6!=".$_REQUEST['sin_3']." AND recetas.ingrediente_7!=".$_REQUEST['sin_3']." AND recetas.ingrediente_8!=".$_REQUEST['sin_3']." AND recetas.ingrediente_9!=".$_REQUEST['sin_3']." AND recetas.ingrediente_10!=".$_REQUEST['sin_3']." AND recetas.ingrediente_11!=".$_REQUEST['sin_3']." AND recetas.ingrediente_12!=".$_REQUEST['sin_3']." AND recetas.ingrediente_13!=".$_REQUEST['sin_3']." AND recetas.ingrediente_14!=".$_REQUEST['sin_3'].")"; } else { $sin .= "(recetas.ingrediente_1!=".$_REQUEST['sin_3']." AND recetas.ingrediente_2!=".$_REQUEST['sin_3']." AND recetas.ingrediente_3!=".$_REQUEST['sin_3']." AND recetas.ingrediente_4!=".$_REQUEST['sin_3']." AND recetas.ingrediente_5!=".$_REQUEST['sin_3']." AND recetas.ingrediente_6!=".$_REQUEST['sin_3']." AND recetas.ingrediente_7!=".$_REQUEST['sin_3']." AND recetas.ingrediente_8!=".$_REQUEST['sin_3']." AND recetas.ingrediente_9!=".$_REQUEST['sin_3']." AND recetas.ingrediente_10!=".$_REQUEST['sin_3']." AND recetas.ingrediente_11!=".$_REQUEST['sin_3']." AND recetas.ingrediente_12!=".$_REQUEST['sin_3']." AND recetas.ingrediente_13!=".$_REQUEST['sin_3']." AND recetas.ingrediente_14!=".$_REQUEST['sin_3'].")"; } } if ($sin != "") { $sin .= " AND "; } $cat = ""; if ($_REQUEST["categoria_1"] && $_REQUEST["categoria_2"]) { $cat = "(categorias.id=".$_REQUEST["categoria_1"]." OR categorias.id=".$_REQUEST["categoria_2"].") AND "; } elseif ($_REQUEST["categoria_1"]){ $cat = "categorias.id=".$_REQUEST["categoria_1"]." AND "; } elseif ($_REQUEST["categoria_2"]){ $cat = "categorias.id=".$_REQUEST["categoria_2"]." AND "; } $cal_recetas = ""; if ($_REQUEST["calorias_recetas"]==1){ $cal_recetas = "recetas.calorias < 100 AND "; } elseif ($_REQUEST["calorias_recetas"]==2){ $cal_recetas = "recetas.calorias >= 100 AND recetas.calorias <= 200 AND "; } elseif ($_REQUEST["calorias_recetas"]==3){ $cal_recetas = "recetas.calorias >= 200 AND recetas.calorias <= 300 AND "; } elseif ($_REQUEST["calorias_recetas"]==4){ $cal_recetas = "recetas.calorias > 300 AND "; } $cal_diarios = ""; if ($_REQUEST["calorias_diarios"]==1){ $cal_diarios = "diario.calorias_total < 1400 AND "; } elseif ($_REQUEST["calorias_diarios"]==2){ $cal_diarios = "diario.calorias_total >= 1400 AND diario.calorias_total <= 1700 AND "; } elseif ($_REQUEST["calorias_diarios"]==3){ $cal_diarios = "diario.calorias_total >= 1700 AND diario.calorias_total <= 2000 AND "; } elseif ($_REQUEST["calorias_diarios"]==4){ $cal_diarios = "diario.calorias_total >= 2000 AND diario.calorias_total <= 2400 AND "; } elseif ($_REQUEST["calorias_diarios"]==5){ $cal_diarios = "diario.calorias_total > 2400 AND "; } if ($_REQUEST["titulo"]!="") { $tit_receta = "(recetas.nombre LIKE '%".$_REQUEST["titulo"]."%' OR recetas.nombre_menu LIKE '%".$_REQUEST["titulo"]."%') AND "; $tit_diario = "(diario.nombre LIKE '%".$_REQUEST["titulo"]."%' OR diario.nombre_menu LIKE '%".$_REQUEST["titulo"]."%' OR recetas.nombre LIKE '%".$_REQUEST["titulo"]."%' OR recetas.nombre_menu LIKE '%".$_REQUEST["titulo"]."%') AND "; $tit_semanal = "(semanal.nombre LIKE '%".$_REQUEST["titulo"]."%' OR semanal.nombre_menu LIKE '%".$_REQUEST["titulo"]."%' OR recetas.nombre LIKE '%".$_REQUEST["titulo"]."%' OR recetas.nombre_menu LIKE '%".$_REQUEST["titulo"]."%') AND "; } $resultados = '
Recetas |
'.$row_buscar_recetas['nombre'].' |
'.substr($row_buscar_recetas['preparacion'],0,200).'... |
disculpe! no hay resultados con estos criterios de busqueda. |
Menús Diarios |
'.$row_buscar_diario['nombre'].' |
disculpe! no hay resultados con estos criterios de busqueda. |
Menús Semanales |
'.$row_buscar_semanal['nombre'].' |
disculpe! no hay resultados con estos criterios de busqueda. |