<?php



$D = date('D');

$A = date('Y');

$M = date('M');

$date = "$A$M$D";

$A = substr($date, 0, 4);

$M = substr($date, 4, 2);

$D = substr($date, 6, 2);

if ($M == '01') {$m = "enero";};

if ($M == '02') {$m = "febrero";};

if ($M == '03') {$m = "marzo";};

if ($M == '04') {$m = "abril";};

if ($M == '05') {$m = "mayo";};

if ($M == '06') {$m = "junio";};

if ($M == '07') {$m = "julio";};

if ($M == '08') {$m = "agosto";};

if ($M == '09') {$m = "septiembre";};

if ($M == '10') {$m = "octubre";};

if ($M == '11') {$m = "noviembre";};

if ($M == '12') {$m = "diciembre";};

?>

<?php function dame_el_dia25 ($fecha)



{



$array_dias['Sunday'] = "domingo";



$array_dias['Monday'] = "lunes";



$array_dias['Tuesday'] = "martes";



$array_dias['Wednesday'] = "miercoles";



$array_dias['Thursday'] = "jueves";



$array_dias['Friday'] = "viernes";



$array_dias['Saturday'] = "sabado";



return $array_dias[date('l', strtotime($fecha))];



}?>
<?php $dia = dame_el_dia25($date); ?>
<?







$hora = date('H');



$min = date('I');



$hora = "$hora.$min";








$sql = "SELECT * FROM programacion WHERE dia = '$dia'";



$consulta = $conn->query($sql);



while ($row = $consulta->fetch_assoc())



{



$programa= $row["programa"];



$ini = $row["ini"];



$fin = $row["fin"];















$ini = str_replace(".","",$ini);



$fin = str_replace(".","",$fin);



$hora = str_replace(".","",$hora);











$ini =  (int) $ini;



$fin = (int) $fin;



$hora = (int) $hora;















if ($hora > $ini) {

if ($hora < $fin) { $ID_P = $programa; $ini2 = $row["ini"];



$fin2 = $row["fin"];};



















} else {};











$sql2 = "SELECT * FROM programas WHERE ID = '$ID_P'";







$consulta2 = $conn->query($sql2);



while ($row2 = $consulta2->fetch_assoc())



{



$nombre_pro = $row2["nombre"];



$imagen = $row2["imagen"];



$url = $row2["url"];







?>







           <?







}



$consulta2->free_result();







}



$consulta->free_result();



?>
