<?php 
include("admin/config.php");
include ('include/head.php');
include ('include/metas.php');
?>
<body>
        <!--[if lt IE 8]>
            <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
        <input type="hidden" value="6" id="txt_servicio"/>
        <?php include 'include/menu.php';     
            $url =$_GET['url'];
            $url_v= filter_var($url,FILTER_SANITIZE_STRING);
            if($url_v){
                $url_c=$url_v.'.html';
                $url_real = mysqli_real_escape_string($con,$url_c);
                $sql = "SELECT * FROM noticias WHERE url = '$url_real'";
                $result=mysqli_query($con,$sql);
                if($result){
                    $filas=mysqli_num_rows($result);
                    if($filas >0){
                       while ($r=mysqli_fetch_array($result)){                              
                         $id_c=$r['categoria'];            
                        if($id_c == 1){?><div class="texto-menu"><div class="container">Noticia</div></div><?php               
                        }elseif($id_c == 2){?><div class="texto-menu"><div class="container">Evento</div></div><?php
                        }
                        ?>
                            <div class="container">
                                 <div class="row">
                                    <div class="col-xs-12 titulo-xs"><br><br>                                
                                        <?php if($id_c == 1){?><h1 class="visible-xs-block">Noticia</h1><?php               
                                            }elseif($id_c == 2){?><h1 class="visible-xs-block">Evento</h1><?php
                                            }
                                        ?>
                                    </div>
                                 </div>
                                <div class="noticia-principal">
                                    <img class="img-responsive center-block"  src="admin/img/noticias/<?php echo $r['imagen_cabecera'];?>" alt="articulo1 principal" />
                                </div>
                            </div>
                            <div class="container noticia">
                                <h1><?php echo $r['titulo'];?></h1>
                                <h2><?php echo $r['bajada'];?> </h2>
                                <div class="row">
                                    <div  class="col-sm-12" >
                                        <div class="texto-noticia">
                                           <?php echo $r['cuerpo'];?>
                                        </div>
                                    </div> 
                                </div>

                                <div class="row">
                                    <div class="noticia-secundaria">
                                        <div  class="col-sm-12">
                                            <img class="img-responsive center-block" src="admin/img/noticias/<?php echo $r['imagen_interna'];?>" alt="factor de arraigo"/>                    
                                        </div>
                                    </div>
                                </div>    
                                <div class="row">
                                    <div  class="col-sm-12">
                                        <!-- Go to www.addthis.com/dashboard to customize your tools -->
                                        <div class="center-block container-redes">
                                            <div class="addthis_inline_share_toolbox "></div>
                                        </div>
                                    </div>
                                </div>
                                <br><br> 
                            </div>
                    <?php }}else{?>
                    <script>
                       window.location.href="404.php";
                    </script>
                    <?php
                      }
                 }else{
                    echo 'Error al ejecutar la consulta';
                } 
            }else{
                echo "Lo sentimos url amigable corrupta o vacía";
            }?>
        <?php  include 'include/footer.php';?>
    </body>
</html>
