Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    djultra89's Avatar
    Title
    Senior Member
    Join Date
    Oct 2012
    Posts
    125
    Rep Power
    0

    Talking now on air

    hi there could someone help me sort the top bits out
    of the coding please as it's not in GMT time or day

    PHP Code:
    <?php //set timezone putenv ('GMT=Europe'); mktime(0,0,0,1,1,1970); $day = date("N"); $time = date("Hi"); if ($day == 7)  { switch($time)     {         case ($time >= '2000' && $time <= '2200'):             echo"<img src='http://hyper-radio.co.uk/djimages/djultra.jpg' alt='DJ200 is On-Air Now' class='onair'/>";             break;         case ($time >= '1000' && $time <= '1200'):             echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";             break;         default:             echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";             break;     } } elseif($day == 6)  {     echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>"; } else  {         switch($time)     {         case ($time >= '0600' && $time <= '0959'):             echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";             break;         case ($time >= '1000' && $time <= '1459'):             echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";             break;         case ($time >= '1500' && $time <= '1859'):             echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";             break;              case ($time >= '1900' && $time <= '2359'):             echo"<img src='images/onair/jrandalharvey.png' alt='J Randal Harvey is On-Air Now' class='onair'/>";             break;                 case ($time >= '2400' && $time <= '0559'):             echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";         default:             echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";             break;             }     } ?>

  2. #2
    PapaBearPW's Avatar
    Title
    Avid Broadcaster
    Join Date
    Jun 2012
    Posts
    273
    Rep Power
    14
    Instead of using putenv(), try using:

    PHP Code:
    date_default_timezone_set("GMT"); 
    That is the proper way to set the default timezone in your script as of php 5.x AFAIK.

    Also, I would remove the mktime() function as it is not doing anything...since you don't seem to be setting it to a variable.

  3. #3
    djultra89's Avatar
    Title
    Senior Member
    Join Date
    Oct 2012
    Posts
    125
    Rep Power
    0
    ok so is this how it goes
    please correct me if im wrong

    PHP Code:
    <?php //set timezone putenv date_default_timezone_set("GMT"); mktime(0,0,0,1,1,1970); $day = date("N"); $time = date("Hi"); if ($day == 7)  { switch($time)     {         case ($time >= '2000' && $time <= '2200'):             echo"<img src='http://hyper-radio.co.uk/djimages/djultra.jpg' alt='DJ200 is On-Air Now' class='onair'/>";             break;         case ($time >= '1000' && $time <= '1200'):             echo"<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";             break;         default:             echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";             break;     } } elseif($day == 6)  {     echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>"; } else  {         switch($time)     {         case ($time >= '0600' && $time <= '0959'):             echo"<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";             break;         case ($time >= '1000' && $time <= '1459'):             echo"<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";             break;         case ($time >= '1500' && $time <= '1859'):             echo"<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";             break;              case ($time >= '1900' && $time <= '2359'):             echo"<img src='images/onair/jrandalharvey.png' alt='J Randal Harvey is On-Air Now' class='onair'/>";             break;                 case ($time >= '2400' && $time <= '0559'):             echo"<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";         default:             echo"<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";             break;             }     } ?>

  4. #4
    PapaBearPW's Avatar
    Title
    Avid Broadcaster
    Join Date
    Jun 2012
    Posts
    273
    Rep Power
    14
    PHP Code:
    <?php
    //set timezone using date_default_timezone_set()

    date_default_timezone_set("GMT");

    //mktime(0,0,0,1,1,1970);

    $day date("N");
    $time date("Hi");

    if (
    $day == 7)  {
        switch(
    $time) {
            case (
    $time >= '2000' && $time <= '2200'):
                echo
    "<img src='http://hyper-radio.co.uk/djimages/djultra.jpg' alt='DJ200 is On-Air Now' class='onair'/>";
            break;
            case (
    $time >= '1000' && $time <= '1200'):
                echo
    "<img src='images/onair/kix103.png' alt='Harold Grimmett is On-Air Now' class='onair'/>";
            break;
            default:
                echo
    "<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
            break;
        }
    }
    elseif(
    $day == 6) {
        echo
    "<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
    } else {
        switch(
    $time) {
            case (
    $time >= '0600' && $time <= '0959'):
                echo
    "<img src='images/onair/steveandboomer.png' alt='Steve &amp; Boomer is On-Air Now' class='onair'/>";
            break;
            case (
    $time >= '1000' && $time <= '1459'):
                echo
    "<img src='images/onair/kc.png' alt='K.C. Wright is On-Air Now' class='onair'/>";
            break;
            case (
    $time >= '1500' && $time <= '1859'):
                echo
    "<img src='images/onair/jr.png' alt='J.R. Schumann' class='onair'/>";
            break;
            case (
    $time >= '1900' && $time <= '2359'):
                echo
    "<img src='images/onair/jrandalharvey.png' alt='J Randal Harvey is On-Air Now' class='onair'/>";
            break;
            case (
    $time >= '2400' && $time <= '0559'):
                echo
    "<img src='images/onair/blairgarner.png' alt='Blair Garner is On-Air Now' class='onair'/>";
            break;
            default:
                echo
    "<img src='images/onair/kix103.png' alt='Kix 103 the Country Leader is On-Air Now' class='onair'/>";
            break;
        }
    }
    ?>

  5. #5
    djultra89's Avatar
    Title
    Senior Member
    Join Date
    Oct 2012
    Posts
    125
    Rep Power
    0
    many thanks great help

  6. #6
    PapaBearPW's Avatar
    Title
    Avid Broadcaster
    Join Date
    Jun 2012
    Posts
    273
    Rep Power
    14
    No problem. Glad to help.

  7. #7
    xhilaration's Avatar
    Title
    Junior Broadcaster
    Join Date
    May 2017
    Location
    Mississippi
    Posts
    28
    Rep Power
    3
    So would this be this est,
    nowonair.php? Can I have a stand alone folder - for example:
    instead of this: images/djsimg/djpic.jpg
    to this: The folder would be 'djsimg'
    djsimg/djpic.jpg

    Thank you ��

  8. #8
    PapaBearPW's Avatar
    Title
    Avid Broadcaster
    Join Date
    Jun 2012
    Posts
    273
    Rep Power
    14
    If by "est" you mean Eastern Standard Time in the USA for the timezone, then you would need to use:

    PHP Code:
    date_default_timezone_set("US/Eastern"); 
    As to where you put your images, that should work too as long as you address it correctly in the script (see below) and the djsimg folder is located in the same location as the php file.

    PHP Code:
    echo"<img src='djsimg/djpic.jpg' alt='INSERT NAME OF PERSON IN djpic.jpg IMAGE HERE is On-Air Now' class='onair'/>"
    Hope that helps.

  9. #9
    xhilaration's Avatar
    Title
    Junior Broadcaster
    Join Date
    May 2017
    Location
    Mississippi
    Posts
    28
    Rep Power
    3
    Quote Originally Posted by PapaBearPW View Post
    If by "est" you mean Eastern Standard Time in the USA for the timezone, then you would need to use:

    PHP Code:
    date_default_timezone_set("US/Eastern"); 
    As to where you put your images, that should work too as long as you address it correctly in the script (see below) and the djsimg folder is located in the same location as the php file.

    PHP Code:
    echo"<img src='djsimg/djpic.jpg' alt='INSERT NAME OF PERSON IN djpic.jpg IMAGE HERE is On-Air Now' class='onair'/>"
    Hope that helps.
    Most definitly, thank you so much!!!

    got another ?

    can we make this into a file & use a code like this

    <echo?=nowplaying.php>
    Yes, I don't have the codeing right but this is example.

    I want to put a simple php code in the body where I want it to appear vs having to put entire code in body
    🌺 Xhilaration 🌺

  10. #10
    PapaBearPW's Avatar
    Title
    Avid Broadcaster
    Join Date
    Jun 2012
    Posts
    273
    Rep Power
    14
    No problem.

    Yes. Assuming you name the file "djimg.php", for example, the code to include it in another php script should be:

    PHP Code:
    include "djimg.php"
    Last edited by PapaBearPW; 06-03-2017 at 08:46 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •