sweaverit Posted January 7, 2010 Share Posted January 7, 2010 My goal is to have the DIV code below inserted on my home page on the following days and times... Is the code correct? What do I need to add to the session go for it string so that I can include the DIV? Is my goal even logical? Thanks in advance for your help. Schedule: Tuesday, Thursday, Saturday & Sunday, from 9:30PM EST - 12:00AM EST <?php session_start(); //check to see if the date and time is Thursday between 7pm and 9pm if (date('H:i') >= 21:30 && date('H:i') <= 24:00 && date('l') == 'Tuesday,Thursday,Saturday,Sunday') { $_SESSION['goforit'] = 'yes'; //or you can comment the above and put the chat functions here } else { $_SESSION['goforit'] = 'no'; } if ($_SESSION['goforit'] == 'yes') {} ?> <div id ="live_banner"><a href="http://www.big3news.net/live.htm" onclick="NewWindow(this.href,'name','1007','663','no');return false"><img src="http://www.big3news.net/images/livebanner_3.gif"></a></div> Link to comment https://forums.phpfreaks.com/topic/187633-linked-image-in-div-shown-at-certain-timesdates-only/ Share on other sites More sharing options...
sweaverit Posted January 9, 2010 Author Share Posted January 9, 2010 Well, I think I need to throw out the initial code I was using. All I want is for an image that says "Big 3 News is Live" to show up on pre-set dates and times, to save myself the trouble of having to go in and modify the source code every time the show goes live. I have tried the code below and for all intents & purposes it SHOULD work, but it isn't. I am using WordPress 2.9. <?php $h = date('G'); //set variable $h to the hour of the day $d = date('w'); //set variable $d to the day of the week. //G is the date key for hours in 24 format (not 12), with no leading 0s, like 02. //W is the day of the week, Mon starts the week, 1. if ($d == 2 && $h >= 21 && $h < 24) $img = 'http://www.big3news.net/images/livebanner_a.gif'; else if ($d == 4 && $h >= 21 && $h < 14) $img = 'http://www.big3news.net/images/livebanner_a.gif'; else if ($d == 6 && $h >= 21 && $h < 14) $img = 'http://www.big3news.net/images/livebanner_a.gif'; else if ($d == 7 && $h >= 21 && $h < 14) $img = 'http://www.big3news.net/images/livebanner_a.gif'; else $img = 'http://www.big3news.net/images/pixel.png'; ?> <div id="live_banner"> <img src="<?php echo $img; ?>"> </div> Link to comment https://forums.phpfreaks.com/topic/187633-linked-image-in-div-shown-at-certain-timesdates-only/#findComment-991442 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.