Redirect when off air

Discussion in 'PHP' started by webber09, Mar 17, 2011.

  1. #1
    Hi guys, i have a online radio station website. I am looking to re-direct my page ONLY when there is no DJ live... and to go to my page when someone is.

    Does anyone know the best way of doing this??

    Thanks all
     
    webber09, Mar 17, 2011 IP
  2. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you need to have a reference variable to check with your php and then process the direct to the proper or redirected page based on if its on or off
     
    srisen2, Mar 17, 2011 IP
  3. dgreenhouse

    dgreenhouse Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Create a semaphore either in a file or a database table.

    
    
    if (! isDjLive()) { // If the DJ is offline...
      
      header("Location: http://somedomain.com/redirectpage.php');
    
    }
    
    // ... Continue loading main page
    
    
    function isDjLive() {
    
      $dj_is_live = false;
    
      /* Code to detect if DJ is online goes here...
          Either a file or a database record  
          ...
      */
    
      return $dj_is_live;
    }
    
    Code (markup):
     
    dgreenhouse, Mar 17, 2011 IP
  4. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this will most likely have to be built into your system using some sort of api that would exist in your radio station software
     
    srisen2, Mar 17, 2011 IP
  5. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #5
    :mad: okay... just wish there was a way the whmsonic or the stream it self could tell the site its 'online/offline' status and be able to work on it from there
     
    webber09, Mar 17, 2011 IP
  6. dgreenhouse

    dgreenhouse Peon

    Messages:
    24
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ask the people at whmsonic if there is anyway of doing this...

    i.e. DJ mode or Autostream mode?

    But I assume you'll probably have to make a DJ "clock in" admin page for the check in.
     
    dgreenhouse, Mar 17, 2011 IP
  7. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #7
    i think i may have to just make a app that when i click on air it stays with my page... but when its off air redirects... god know how im gonna do this but we shall see
     
    webber09, Mar 18, 2011 IP
  8. vediovis

    vediovis Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    dgreenhouse idea looks efficient.
     
    vediovis, Mar 22, 2011 IP
  9. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #9
    would anyone know how to write a ftp batch file so when i click a button for on air, it uploads my normal page. then when i click off air, it uploads the redirect page?
     
    webber09, Mar 25, 2011 IP