• It’s a bit advanced I’m afrais and i’m not sure if it’s here or a specific php forum i need to post to but here goes.

    I’ve just set up a video bookmarking site for wildlife and nature videos.

    i’m using the auto embed (with some of the sites taken out of the whitielist).

    The content of the posts comes from a url form field object. Every thing works ok and the video is posted.

    What I need to do though is to pass the video url from the form field through some sort of validation to check the domain is youtube or vimeo etc otherwise people can post any url address and it gets passed though to the comment.

    any idea as to the best way of going about setting up this whitelist validation.

    if you nee to see how its working then the web site is wildlifenews.tv

    thanks
    Kevin

Viewing 1 replies (of 1 total)
  • Thread Starter kevin heath

    (@ypraise)

    ok this works but is it sound?

    could someone just check this is the best way to run a whitelist on a url sumission from a form.

    $url1 = ($_POST['video_url']);
    $whitelisted_domains = array( 'www.youtube.com','youtube.com', 'www.dailymotion.com', 'vimeo.com', 'www.vimeo.com', 'flickr.com', 'www.flickr.com', 'blip.tv', 'www.blip.tv' );
    $domain = parse_url( $url1, PHP_URL_HOST );
    
    if ( !in_array( $domain, $whitelisted_domains ) )
     $error_array[]='Video site not supported.';

    thanks
    Kevin

Viewing 1 replies (of 1 total)
  • The topic ‘checking url against whitelist’ is closed to new replies.