Support » Fixing WordPress » checking url against whitelist

  • 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


Viewing 1 replies (of 1 total)
  • 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( '','', '', '', '', '', '', '', '' );
    $domain = parse_url( $url1, PHP_URL_HOST );
    if ( !in_array( $domain, $whitelisted_domains ) )
     $error_array[]='Video site not supported.';


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