Jump to content

[Useful] Now On Air Script


mattskills
 Share

Recommended Posts

  • 2 years later...
  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

this is doing my head in peeps, please help

 

<?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.

$year = date('Y'); //set variable $year to the current year

//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.

// Adjust 2 hour offset for MST below.

$h = $h-0;

 

 

 

 

// MONDAY SCHEDULE

if ($d == 1 && $h >= 0 && $h

else if ($d == 1 && $h >= 8 && $h

else if ($d == 1 && $h >= 14 && $h

else if ($d == 1 && $h >= 16 && $h

else if ($d == 1 && $h >= 18 && $h

else if ($d == 1 && $h >= 20 && $h

else if ($d == 1 && $h >= 22 && $h

else if ($d == 2 && $h

 

 

 

 

// TUESDAY SCHEDULE

if ($d == 2 && $h >= 0 && $h

else if ($d == 2 && $h >= 4 && $h

else if ($d == 2 && $h >= 14 && $h

else if ($d == 2 && $h >= 16 && $h

else if ($d == 2 && $h >= 19 && $h

else if ($d == 2 && $h >= 20 && $h

else if ($d == 2 && $h >= 22 && $h

else if ($d == 3 && $h

 

 

 

 

// WEDNESDAY SCHEDULE

if ($d == 3 && $h >= 0 && $h

else if ($d == 3 && $h >= 4 && $h

else if ($d == 3 && $h >= 14 && $h

else if ($d == 3 && $h >= 16 && $h

else if ($d == 3 && $h >= 18 && $h

else if ($d == 3 && $h >= 19 && $h

else if ($d == 3 && $h >= 21 && $h

else if ($d == 4 && $h >= 0) $img = '/new/images/jukebox.gif';

 

 

 

 

 

 

 

 

// THURSDAY SCHEDULE

if ($d == 4 && $h >= 0 && $h

else if ($d == 4 && $h >= 4 && $h

else if ($d == 4 && $h >= 14 && $h

else if ($d == 4 && $h >= 16 && $h

else if ($d == 4 && $h >= 18 && $h

else if ($d == 4 && $h >= 20 && $h

else if ($d == 4 && $h >= 22 && $h

else if ($d == 5 && $h

 

 

 

 

 

 

 

 

// FRIDAY SCHEDULE

if ($d == 5 && $h >= 0 && $h

else if ($d == 5 && $h >= 19 && $h

else if ($d == 5 && $h >= 14 && $h

else if ($d == 5 && $h >= 16 && $h

else if ($d == 5 && $h >= 18 && $h

else if ($d == 5 && $h >= 20 && $h

else if ($d == 5 && $h >= 18 && $h

else if ($d == 6 && $h >= 0 && $h

 

 

 

 

 

 

 

 

// SATURDAY SCHEDULE

if ($d == 6 && $h >= 0 && $h

else if ($d == 5 && $h >= 19 && $h

else if ($d == 6 && $h >= 18 && $h

else if ($d == 6 && $h >= 18 && $h

else if ($d == 6 && $h >= 18 && $h

else if ($d == 6 && $h >= 18 && $h

else if ($d == 6 && $h

 

 

 

 

 

 

 

 

// SUNDAY SCHEDULE

if ($d == 5 && $h >= 0 && $h

else if ($d == 5 && $h >= 23 && $h

else if ($d == 0 && $h >= 10 && $h

else if ($d == 0 && $h >= 14 && $h

else if ($d == 0 && $h >= 16 && $h

else if ($d == 0 && $h >= 18 && $h

else if ($d == 0 && $h >= 23 && $h

else if ($d == 0 && $h >= 18 && $h

else if ($d == 0 && $h

?>

 

 

 

 







<?php echo $img; ?>


 

 

it is showing up with no picture please help

Edited by djaubs89
Link to comment
Share on other sites

I just need one that shows the current DJ name that is On Air. so if it is DJ Auto that is what it shows, or the current DJ. I have never had to deal with a schedule of any sort. I dont know how my old Server was getting the name of the DJ that was on air. It is like they are pulling it from the database that has all the DJ accounts to see who is logged in, and if nobody is on air, it shows Auto Dj. I wonder why makeavoice can do it but i cannot find someone else that can do that?
Link to comment
Share on other sites

i may of got it rite now

 

$h = date('G'); //set variable $h to the hour of the day
$d = date('w'); //set variable $d to the day of the week.
$year = date('Y'); //set variable $year to the current year
//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.
// Adjust 2 hour offset for MST below.
$h = $h-0;

// MONDAY SCHEDULE
if ($d == 1 && $h >= 0 && $h else if ($d == 0 && $h >= 8 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// TUESDAY SCHEDULE
if ($d == 2 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 19 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// WEDNESDAY SCHEDULE
if ($d == 3 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 19 && $h else if ($d == 5 && $h >= 21 && $h else if ($d == 6 && $h >= 0) $img = '/images/jukebox.gif';

// THURSDAY SCHEDULE
if ($d == 4 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// FRIDAY SCHEDULE
if ($d == 5 && $h >= 0 && $h else if ($d == 0 && $h >= 19 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h >= 0 && $h 
// SATURDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h else if ($d == 1 && $h >= 19 && $h else if ($d == 2 && $h >= 18 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 18 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h 
// SUNDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h else if ($d == 1 && $h >= 23 && $h else if ($d == 2 && $h >= 10 && $h else if ($d == 3 && $h >= 14 && $h else if ($d == 4 && $h >= 16 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h >= 23 && $h else if ($d == 0 && $h >= 18 && $h else if ($d == 0 && $h ?>











<?php echo $img; ?>






 

 

but if now is there any other codes i can use at all

Edited by James
Link to comment
Share on other sites

i may of got it rite now

 

$h = date('G'); //set variable $h to the hour of the day
$d = date('w'); //set variable $d to the day of the week.
$year = date('Y'); //set variable $year to the current year
//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.
// Adjust 2 hour offset for MST below.
$h = $h-0;

// MONDAY SCHEDULE
if ($d == 1 && $h >= 0 && $h else if ($d == 0 && $h >= 8 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// TUESDAY SCHEDULE
if ($d == 2 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 19 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// WEDNESDAY SCHEDULE
if ($d == 3 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 19 && $h else if ($d == 5 && $h >= 21 && $h else if ($d == 6 && $h >= 0) $img = '/images/jukebox.gif';

// THURSDAY SCHEDULE
if ($d == 4 && $h >= 0 && $h else if ($d == 0 && $h >= 4 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 22 && $h else if ($d == 6 && $h 
// FRIDAY SCHEDULE
if ($d == 5 && $h >= 0 && $h else if ($d == 0 && $h >= 19 && $h else if ($d == 1 && $h >= 14 && $h else if ($d == 2 && $h >= 16 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 20 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h >= 0 && $h 
// SATURDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h else if ($d == 1 && $h >= 19 && $h else if ($d == 2 && $h >= 18 && $h else if ($d == 3 && $h >= 18 && $h else if ($d == 4 && $h >= 18 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h 
// SUNDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h else if ($d == 1 && $h >= 23 && $h else if ($d == 2 && $h >= 10 && $h else if ($d == 3 && $h >= 14 && $h else if ($d == 4 && $h >= 16 && $h else if ($d == 5 && $h >= 18 && $h else if ($d == 6 && $h >= 23 && $h else if ($d == 0 && $h >= 18 && $h else if ($d == 0 && $h ?>











<?php echo $img; ?>






 

 

but if now is there any other codes i can use at all

 

Updated your post to add the [ CODE ] tags. Please use them in future.

 

What do you mean by "any other codes i can use at all" ?

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

  • 1 month later...

ok the code that is in here is not showing up the images on the server please help

 

 

 









http://www.106themix.com/onairinfo/images/logo.gif


Loading ...


Link to comment
Share on other sites

display();

function display() {

var show = "No show scheduled at present";

var GMToffset = -5; // Your current GMT offset, whether Standard or Daylight

var now = new Date();

var dy = now.getDay(); // day of week 0-6

now.setHours(GMToffset + now.getHours() + now.getTimezoneOffset() / 60);

var hh = now.getHours();

var mn = now.getMinutes();

var ss = now.getSeconds();

hh = hh + (mn/60); // minutes expressed as fractions of an hour

 

 

 

 

// The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule

// that is appropriate for the site owner's local time.

 

 

 

 

// Tip - for testing purposes you can put here

//dy = 5;

//hh = 9.25;

// or whatever to check that the right show appears at that day/time.

 

 

if (dy == 0) { // Sundays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=18 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 1) { // Mondays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 2) { // Tuesdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 3) { // Wednesdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 4) { // Thursdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 5) { // Fridays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=18 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 6) { // Saturdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=18 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

var a = '' + show + '';

document.getElementById("dj").innerHTML = a;

 

 

setTimeout(function(){display()}, 60000); // update every 60 seconds

}

 

 

 

 

this is the code

Link to comment
Share on other sites

You are calling the function at the top. That means that your javascript is running and trying to find an element on the page that isn't there yet. Somewhere on your page is a div with an id="dj" ... make sure you are calling your display function from inside the div. That way you can be sure that the div has shown up on the page before the javascript tries to find it. Should look something like this then:

 


  <br />
      display();<br />
   

 

Then you can remove the display(); call at the top of the javascript since it isn't needed and will just slow down the page load a tick. That should fix your problem with images not showing.

 

As to the times for any given day, I still think the best way to do this would be to set an image for each hour of the day. Something like:

if (hh >=0 && hh else if (hh >=1 && hh else if (hh >=2 && hh else if (hh >=3 && hh else if (hh >=4 && hh else if (hh >=5 && hh else if (hh >=6 && hh else if (hh >=7 && hh else if (hh >=8 && hh else if (hh >=9 && hh else if (hh >=10 && hh else if (hh >=11 && hh else if (hh >=12 && hh else if (hh >=13 && hh else if (hh >=14 && hh else if (hh >=15 && hh else if (hh >=16 && hh else if (hh >=17 && hh else if (hh >=18 && hh else if (hh >=19 && hh else if (hh >=20 && hh else if (hh >=21 && hh else if (hh >=22 && hh else if (hh >=23) {show = "http://urban-radio.co.uk/images/jukebox.gif";}

 

This way, you can just put any dj in at any time of any day since it is all pre-scripted.

 

As to setting it to UK time, you should just need to set the variable near the top of the javascript called GMToffset to +1 instead of -5.

Link to comment
Share on other sites

i would like to know why this script is not working for me

 

<?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.

$year = date('Y');

//set variable $year to the current year

//G is the date key for hours in 24 format (not 12), with no leading 0s, like 02.

// Adjust 2 hour offset for MST below.

$h = $h-0;

 

 

// MONDAY SCHEDULE

if ($d == 1){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

// TUESDAY SCHEDULE

if ($d == 2){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

// WEDNESDAY SCHEDULE

if ($d == 3){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

 

 

// THURSDAY SCHEDULE

if ($d == 4){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

 

 

// FRIDAY SCHEDULE

if ($d == 5){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

// SATURDAY SCHEDULE

if ($d == 6){

if($h >= 20 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 18 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

 

 

// SUNDAY SCHEDULE

if ($d == 0){

if($h >= 0 && $h

else if ($h >= 8 && $h

else if ($h >= 9 && $h

else if ($h >= 10 && $h

else if ($h >= 11 && $h

else if ($h >= 12 && $h

else if ($h >= 13 && $h

else if ($h >= 14 && $h

else if ($h >= 15 && $h

else if ($h >= 16 && $h

else if ($h >= 17 && $h

else if ($h >= 18 && $h

else if ($h >= 19 && $h

else if ($h >= 20 && $h

else if ($h >= 21 && $h

else if ($h >= 22 && $h

else if ($h >= 23 && $h

}

?>

 

 







<?php echo $img; ?>


 

am i doing something wrong or what. as its not changing image from autodj to our djs image at 18 to 20

Link to comment
Share on other sites

or this code

 

display();

function display() {

var show = "No show scheduled at present";

var GMToffset = -5; // Your current GMT offset, whether Standard or Daylight

var now = new Date();

var dy = now.getDay(); // day of week 0-6

now.setHours(GMToffset + now.getHours() + now.getTimezoneOffset() / 60);

var hh = now.getHours();

var mn = now.getMinutes();

var ss = now.getSeconds();

hh = hh + (mn/60); // minutes expressed as fractions of an hour

 

 

 

 

// The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule

// that is appropriate for the site owner's local time.

 

 

 

 

// Tip - for testing purposes you can put here

//dy = 5;

//hh = 9.25;

// or whatever to check that the right show appears at that day/time.

 

 

if (dy == 0) { // Sundays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=18 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 1) { // Mondays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 2) { // Tuesdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 3) { // Wednesdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh

else if (hh >=17 && hh

else if (hh >=18 && hh

else if (hh >=20 && hh

else if (hh >=21 && hh

else if (hh >=22 && hh

}

 

 

else if (dy == 4) { // Thursdays

if (hh >=0 && hh

else if (hh >=1 && hh

else if (hh >=3 && hh

else if (hh >=5 && hh

else if (hh >=13 && hh