Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS HELP: PHP redirct within a certain div rather than an entire site page

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #40776

    I manage my schools robotics team website but i cant embed youtube videos onto the website without the school blocking it. they have agreed to not block it if i can specify for the videos to not be shown if the IP if the ip that the school uses for student computers.
    Can i make a specific content div within a page display a youtube video if an ip is anything except for the 1 specific ip that all of the school computers have? also how would i have it display something besides the video like an error image instead of the video.

    i have fundamental PHP knowledge and i assume this is what is involved.
    Alternativly i can have the page redirect to another page on my website like http://www.website.com/content-alt rather than /content. which way would be an easier/better way to do this and could someone help me write the code for this?

    THANKS!

    #114191
    Watson90
    Member

    Hey @tylerrichardson96

    Sounds quite strange the way you would have to go through all that just to get a YouTube video to work on your website.

    What you could do however is open YouTube, search for the video and click it, then grab the URL of that video and copy it.

    Once you have that you could head on over to http://www.keepvid.com and enter the URL in the address bar on there. Save it in a different format (for example – .FLV) and download it to your computer.

    Then you could just use a plugin such as [FlowPlayer](http://flowplayer.org/ “”) and embed it that way?

    #114219

    @traq, im not sure how to write the code at all, ive done a bit of research and i found this redirect based on ip:

    $allowed = array(“94.171.121.121”);
    $ip = $_SERVER;
    if(!in_array($ip, $allowed))
    {
    header(“Location: http://www.google.co.uk); /* Redirect browser */
    /* Make sure that code below does not get executed when we redirect. */
    exit;
    }
    else
    {

    }
    ?>

    how can i manipulate this to make it apply to a single element (my div with the youtube video) rather than the entire page of the website?

    #114334

    Thanks so much!!! 1 last question, how can i have it display something else instead of the video, i assume i would put it after the 2nd print, but what is the php syntax for ‘printing’ a picture?

    #114389
    __
    Participant

    These is no such special syntax.

    PHP is not an “alternative” to HTML; PHP *writes* HTML.

    print ‘my picture‘;

    (Yes, it would be inside the `else` block.)

    #114729

    Thanks so much :) i put the code into my website and this is what is looks like http://www.firstteam3600.com/videos i dont have my blocked ip yet so i have both ip events as the same thing. can you tell me why the code is showing up in the website?

    #114735
    Paulie_D
    Member

    My guess is that you haven’t closed a tag or something.

    FIRST Videos

    $userIP = $_SERVER;
    $badIP = ‘000.000.000.000’;
    if( $userIP == $badIP ){
    print ‘‘;
    }
    else{
    print ‘‘;
    }
    ?>

     

    #114816
    __
    Participant

    > this is what is looks like http://www.firstteam3600.com/videos

    actually, I get a 404.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.