Forums

Give help. Get help.

  • # November 13, 2012 at 9:57 am

    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!

    # November 13, 2012 at 10:50 am

    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?

    # November 13, 2012 at 1:34 pm

    @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:

    < ?php
    $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?

    # November 14, 2012 at 2:54 pm

    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?

    __
    # November 14, 2012 at 6:56 pm

    These is no such special syntax.

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

    < ?php
    print ‘my picture‘;

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

    # November 19, 2012 at 8:23 am

    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?

    # November 19, 2012 at 10:58 am

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

    FIRST Videos

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

     

    __
    # November 19, 2012 at 8:52 pm

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

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag