0 ){ $url=retorna_url_amigable('noticia',$_REQUEST['noticia']); header('Location: '.$url,TRUE,301); exit; } $noticias_general=0; if($_REQUEST['seo_url']!=""){ //$id_noticia=check_input($_REQUEST['noticia']); // mes i any a mostrar $sql="SELECT DISTINCT year(data), month(data), id_noticia FROM tb_noticies WHERE actiu=1 AND seo_url=".check_input($_REQUEST['seo_url']); // echo $sql; $sel_data=mysqli_query($sql); if (mysqli_num_rows($sel_data)>0){ $arr_data=mysqli_fetch_assoc($sel_data); $mes=$arr_data['month(data)']; $any=$arr_data['year(data)']; $id_noticia=$arr_data['id_noticia']; } }else{ $noticias_general=1; if ( ($_REQUEST['mes']=="") && ($_REQUEST['ano']=="") && ($_REQUEST['seo_url']=="") ){ // ULTIMA NOTICIA // seo general $seo_title = "Noticias inmobiliarias Barcelona Alto Standing | Inmofinders"; $seo_keywords = "inmobiliarias barcelona alto standing"; $seo_description = "Noticias inmobiliarias Barcelona alto standing. Todo sobre el mercado inmobiliario, alquiler y venta. Los pisos de lujo en Barcelona y en el mundo. Inmofinders"; $sql="SELECT id_noticia, year(data), month(data) FROM tb_noticies WHERE actiu=1 ORDER BY data DESC, id_noticia DESC LIMIT 1"; //echo $sql; $sel_not=mysqli_query($sql); if(mysqli_num_rows($sel_not)>0){ $arr_not=mysqli_fetch_assoc($sel_not); $id_noticia=$arr_not['id_noticia']; $any=$arr_not['year(data)']; $mes=$arr_not['month(data)']; } }else if ( ($_REQUEST['ano']!="") && ($_REQUEST['mes']=="") ){ // ULTIMA NOTICIA ANY $any=check_input($_REQUEST['ano']); $sql="SELECT DISTINCT id_noticia, month(data) FROM tb_noticies WHERE actiu=1 AND year(data)=$any ORDER BY data DESC, id_noticia DESC LIMIT 1"; //echo $sql; $sel_not=mysqli_query($sql); if(mysqli_num_rows($sel_not)>0){ $arr_not=mysqli_fetch_assoc($sel_not); $id_noticia=$arr_not['id_noticia']; $mes=$arr_not['month(data)']; } }else if( ($_REQUEST['ano']!="") && ($_REQUEST['mes']!="") ){ // NOTICIES D'UN ANY+MES CONCRET $any=check_input($_REQUEST['ano']); $mes=check_input($_REQUEST['mes']); $sql="SELECT DISTINCT id_noticia FROM tb_noticies WHERE actiu=1 AND year(data)=$any AND month(data)=$mes ORDER BY data DESC, id_noticia DESC LIMIT 1"; //echo $sql; $sel_not=mysqli_query($sql); if(mysqli_num_rows($sel_not)>0){ $arr_not=mysqli_fetch_assoc($sel_not); $id_noticia=$arr_not['id_noticia']; } } } if (!isset($id_noticia)){ header("HTTP/1.0 404 Not Found"); require_once '404.php'; exit; } $sel_seo=mysqli_query("SELECT * FROM tb_noticies WHERE id_noticia='$id_noticia'"); $arr_seo=mysqli_fetch_assoc($sel_seo); $seo_title = utf8_encode($arr_seo["seo_title"]); $seo_keywords = utf8_encode($arr_seo["seo_keywords"]); $seo_description = utf8_encode($arr_seo["seo_description"]); ?>