  <?
mysql_connect ("$host", "$usuario", "$contra");
mysql_select_db ("$basedatos");
$sql = "SELECT ID,titulo,bajada,texto,audio,youtube,d,m,a,carpetafoto,foto,cat,home,impresiones,ext_img  FROM notas WHERE destacado = 'si' AND ver = 'si' ORDER BY ID desc";
$consulta = mysql_query ($sql);
while ($row = mysql_fetch_array($consulta))
{
$i_publi = $i_publi + 1;
$ID = $row["ID"];
$youtube  = $row["youtube"];
$titulo = $row["titulo"];
$bajada = $row["bajada"];
$texto = $row["texto"];
$audio = $row["audio"];
$listengo  = $row["listengo"];
$d = $row["d"];
$m = $row["m"];
$a = $row["a"];
$fecha = "$d - $m - $a";
$carpetafoto = $row["carpetafoto"];
$foto = $row["foto"]; $ext_img = $row["ext_img"];
$cat = $row["cat"];
$impresiones = $row["impresiones"];
$impresiones = $impresiones + 1;
$sSQL="UPDATE  `$basedatos`.`notas` SET  `impresiones` =  '$impresiones' WHERE ID = '$ID'";
mysql_db_query("$basedatos",$sSQL);


if ($cat == 0) {} else {
$sql2 = "SELECT * FROM categorias WHERE ID = '$cat'";
$consulta2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_array($consulta2))
{
$cat = $row2["nombre"];
$color_cat = $row2["color"];
}
mysql_free_result($consulta2);
}
?>
<?
$n = 0;
$sql2 = "SELECT * FROM comentarios WHERE IDD = '$ID' and ver = 'si'";
$consulta2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_array($consulta2))
{
$n = $n + 1;
}
mysql_free_result($consulta2);
?>


<div class="grid-item col-12 col-sm-6 col-md-6 col-lg-6 mb-3 border" >
<b>LUGAR: <?php echo $i_publi ?></b>

<div class="col-12" style="background-color:<?php echo $d_color_destacada?>;">

  <?php if ($cat == '0') {} else {?> 


    <div class="col-12">
    <p><?php echo $cat ?></p>
    </div>
  


  <?php };?>

  <div class="col-12">

    <a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>" >

      <h4 style="color:#fff;"><?php echo $titulo ?></h4>

    </a>

  </div>


<?php  if ($foto == NULL) { } else { ?> 



      <div class="col-12">

        <a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>"> 
            <img loading="lazy" class="img-fluid"
            src="<? $fotojj = substr($foto,0,4); if ($fotojj == 'http') { echo $foto; } else { echo "$dom/$carpetafoto/thumbnail_$foto$ext_img"; }; ?>"
            alt="<?php echo $titulo ?>">        </a>

      </div>

      <?php 
      $sql65 = "SELECT ID FROM fotos_notas WHERE noticia = '$ID' LIMIT 1";
      $consulta65 = mysql_query ($sql65);
      while ($row65 = mysql_fetch_array($consulta65))
      {

      ?>
        <div class="col-12">

          <a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>">
            <img src="fotogaleria.png" class="img-fluid" />
          </a>
        </div>
      <?
      }
      mysql_free_result($consulta65);
      ?>

<?php  }; ?>

<?php  if ($youtube == NULL) { } else { ?>   

  <div class="col-12">
    
      <iframe width="<? echo $marco1px ?>" height="315" src="https://www.youtube.com/embed/<?php echo $youtube ?>" frameborder="0" allowfullscreen></iframe>
    
  </div> 

<?php  }; ?>

<div class="col-12">

    <div class="col-12">
    <p style="color:#fff;"><?php echo $bajada ?></p>
    <p style="color:#fff;"><?php echo $fecha ?></p>
    </div>
    
  <?php include 'audio.php'; ?>

</div>


<div class="col-12">

<ul> 

<?php if ($n == 0) { ?>
<li><a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>">Dejar un comentario<? if ($texto == NULL) {} else {?> - Leer m&aacute;s...<? }; ?></a> 
</li>

<?php } else {?>
<li><a href="<? echo $dom;?>/nota/<?php echo $ID ?>/<?php echo urls_amigables($titulo) ?>"> <?php echo $n ?> comentarios<? if ($texto == NULL) {} else {?> - Leer m&aacute;s...<? }; ?></a>
</li>

<?php };?>

</ul>

</div>


<div class="col-12">  

<?php include 'compartir_nota_facebook.php';?>

  </div>



<?php 
mysql_connect ("$host", "$usuario", "$contra");
mysql_select_db ("$basedatos");
$sql2 = "SELECT * FROM publicidades WHERE lugar = '$i_publi'";
$consulta2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_array($consulta2))
{
$img = $row2["img"];
$url = $row2["url"];

$carpetafoto = $row2["carpetafoto"];

?>

<div class="col-12"> 
<?php   if ($url == NULL) {} else { ?>

<a href="<?php echo $url ?>"  target="_blank" class=""><?php };?>
<img src="<?php echo $carpetafoto?>/resize_<?php echo $img ?>.jpg" width="<? echo $marco1px ?>"  alt="PUBLICIDAD"  class="img-fluid" /><?php   if ($url == NULL) {} else { ?> </a><?php };?>
</div>

<?
}
mysql_free_result($consulta2);
?>


<?php 
////////////GIF
mysql_connect ("$host", "$usuario", "$contra");
mysql_select_db ("$basedatos");
$sql2 = "SELECT * FROM publicidades_gif WHERE lugar = '$i_publi'";
$consulta2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_array($consulta2))
{
  $ID_p = $row2["ID"];
$img = $row2["img"];
$url = $row2["url"];
$carpetafoto = $row2["carpetafoto"];
?>

<div class="col-12">

<?php   if ($url == NULL) {} else { ?>

<a href="<?php echo $url ?>"  target="_blank" class="Estilo1"><?php };?>
<img src="<?php echo $dom ?>/<?php echo $carpetafoto?>/<?php echo $img ?>" width="<? echo $marco1px ?>" class="img-fluid" /><?php   if ($url == NULL) {} else { ?></a><?php };?>
  </div>
  <a class="btn btn-outline-primary" href="quitar_publicidad_gif_noticias.php?ID=<?php echo $ID_p ?>">QUITAR jpg/gif DEL LUGAR</a> 

<?
}
mysql_free_result($consulta2);
//////////////////// FIN GIF
?>

<?php
////////////SLIDE
$sql2 = "SELECT ID FROM publicidades_slide WHERE lugar = '$i_publi'";
$consulta2 = mysql_query ($sql2);
while ($row2 = mysql_fetch_array($consulta2))
{
$ID_p = $row2["ID"];

$width_slide = "$marco1px";  include 'publicidad_slider_virgen.php';
?> 
<a class="btn btn-outline-primary" href="quitar_publicidad_slide_noticias.php?ID=<?php echo $ID_p ?>">QUITAR SLIDE DEL LUGAR</a> <?
}
mysql_free_result($consulta2);
//////////////////// FIN SLIDE
?>



<?php     $tam_ancho = 300;
mysql_connect ("$host", "$usuario", "$contra");
mysql_select_db ("$basedatos");
$sql44 = "SELECT * FROM publicidades_swf WHERE lugar = $i_publi";
$consulta44 = mysql_query ($sql44);
while ($row44 = mysql_fetch_array($consulta44))
{
$ID = $row44["ID"];
$swf = $row44["swf"];
$carpetafoto = $row44["carpetafoto"];
$ancho = $row44["ancho"];
$alto = $row44["alto"];
$lugar = $row44["lugar"];
$tam_alto = $alto * $tam_ancho / $ancho;
?>
<div class="col-12">

<object  width="<?php echo $tam_ancho ?>" height="<?php echo $tam_alto ?>">
<param name="src" value="<? echo $dom ?>/<?php echo $carpetafoto ?>/<?php echo $swf ?>" />
<embed src="<? echo $dom ?>/<?php echo $carpetafoto ?>/<?php echo $swf ?>" pluginspage="http://www.adobe.com/shockwave/download/" width="<?php echo $tam_ancho ?>" height="<?php echo $tam_alto ?>"></embed>
</object>

</div>

<?
}
mysql_free_result($consulta44);
?>

</div class="col-12">



  <div class="col-12">
    <form id="form1" name="form1" method="POST" action="panel/poner_publicidad_en_noticias.php">
        <p>Agregar publi</p>
    <div class="d-flex justify-content-between mb-3">
        
      <input name="button" type="submit" class="btn btn-outline-primary" id="button" value="Flash" />
    
      <input name="lugar" type="hidden" value="<?php echo $i_publi ?>" />
 
      <input name="button" type="submit" class="btn btn-outline-primary" id="button" value="Jpg" />
    
      <input name="button" type="submit" class="btn btn-outline-primary" id="button" value="Gif/Png" />
     
      <input name="button" type="submit" class="btn btn-outline-primary" id="button" value="Slider" />
    </div>
    </form>
     
     
     
  </div>


</div>
<?php }
mysql_free_result($consulta);?>
