I want to allow users to add youtube videos using the provided <embed> code that youtube provides. Is there a way to make sure that users don't try to sqlinject or run other code that is not a youtube video?
I recently used this to allow people to paste the embed code into a field. It then extracted the YouTube ID code from the pasted code and re-created the HTML. Hope it helps and if anyone sees anything wrong with it, please let me know: