Publisher is the useful and powerful WordPress Newspaper , Magazine and Blog theme with great attention to details, incredible features...

[diario_shortcode template=”card_img” colunas=”4″ s=”internofolha” numero_de_parceiros=”4″ mono_post=”sim” colunas=”4″ top=”4″]

Mostrar Banner por horário programado em PHP

Então, agora tá blz puxando certinho, eu sou iniciante em PHP e as vezes me perco com os códigos a única coisa agora é que está aparecendo um pedaço do código no local, não estou acertando o local correto que devo colocar o mesmo vc pode me orientar denovo? estou colocando assim:
<?php
date_default_timezone_set(‘America/Recife’);

$script_tz = date_default_timezone_get();

if (strcmp($script_tz, ini_get(‘date.timezone’))){
echo ‘Script timezone differs from ini-set timezone.’;
} else {
echo ‘Script timezone and ini-set timezone match.’;
}
function window_player($link, $img, $width = 370, $height = 50)
{
return ‘<a style=”font-weight: bold;”
class=”frase”
href=”‘ . $link . ‘”
target=”_blank”
onclick=”window.open(this.href, this.target, ‘width=’ . $width . ‘,height=’ . $height . ”); return false;”><img src=”http://studioandreluis.com.br/radiopajeu/imagens/’ . $img . ‘” /></a>’;
}

$horas = date(“Gis”);
$semana = date(“w”); // 0 (para domingo) até 6 (para sábado)

// De segunda a sexta
if ($semana > 0 and $semana < 6) {
// 4:00:00 – 5:00:00
if (40000 < $horas and 50000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘acorda-sertao.png’);
}
// 5:00:00 – 7:00:00
elseif (50000 < $horas and 70000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘radio-vivo.png’);
}
// 7:00:00 – 7:30:00
elseif (70000 < $horas and 73000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘jornal-brasil-hoje.png’);
}
// 7:30:00 – 8:00:00
elseif (73000 < $horas and 80000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘encontro-de-fe.png’);
}
// 8:00:00 – 11:30:00
elseif (80000 < $horas and 113000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘manha-total.png’);
}
// 11:30:00 – 12:00:00
elseif (113000 < $horas and 120000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘encontro-com-a-poesia.png’);
}
// 12:30:00 – 13:00:00
elseif (123000 < $horas and 130000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘resenha-esportes.png’);
}
// 13:00:00 – 16:00:00
elseif (130000 < $horas and 160000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘comando-geral.png’);
}
// 16:00:00 – 18:00:00
elseif (160000 < $horas and 180000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘crepusculo-sertanejo.png’);
}
// 18:00:00 – 19:00:00
elseif (180000 < $horas and 190000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘frente-frente.png’);
}
// 19:00:00 – 20:00:00
elseif (190000 < $horas and 200000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘voz-do-brasil.png’);
}
// 20:00:00 – 22:00:00
elseif (200000 < $horas and 220000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘em-dia-com-a-noite.png’);
}
}
// Sábado e domingo
elseif (190000 < $horas and 220000 > $horas) {
echo window_player(‘http://www.studioandreluis.com.br/radiopajeu/player.html’, ‘em-dia-com-a-noite.png’);
date_default_timezone_set(‘America/Recife’);
}
?>

Mais uma coisinha, para configurar sabado e domingo é só repetir como o código dos outros dias trocando apenas as imagens?

fonte : http://phpbrasil.com/phorum/read.php?1,86706

Comments are closed.