Embedded code filtering.

Discussion in 'PHP' started by mightyb, Jun 21, 2006.

  1. #1
    Im working on a new project and i want certain users to be able to post embedded videos. Af far as i know this is quite risky in terms of security. Is there any way i can make sure that only embedded code from certain trusted sites (eg Google videos, yahoo videos, youtube etc) gets interpreted? I have a config file that i can edit to allow certain html tags. Can this be done by editing that file?

    Thanks a lot guys! :)
     
    mightyb, Jun 21, 2006 IP
  2. dtang4

    dtang4 Active Member

    Messages:
    303
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You can parse the code for certain keyphrases.
    e.g. preg_match('/src=http:\/\/.*video\.google\.com/', $embedded_code)

    EDIT: it may be easier/faster to use stristr()
     
    dtang4, Jun 24, 2006 IP