Jump to content

Recommended Posts

I want people to be able to paste the embedded youtube code into a form on mysite. Obviously this is a secuirty threat do to mysql injections. how would the best way to proceed be?

 

"<object width="480" height="385"><param name="movie" value="

name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="
type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>"
Link to comment
https://forums.phpfreaks.com/topic/201256-youtube-security/
Share on other sites

<object width="480" height="385">
  <param name="movie" value="http://www.youtube.com/v/xFYQQPAOz7Y"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="http://www.youtube.com/v/xFYQQPAOz7Y"
    type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
    width="480" height="385">
  </embed>
</object>

 

All you need to ask from the user is xFYQQPAOz7Y through the YouTube API you can ask if it's a valid YouTube Video.

 

http://code.google.com/intl/nl/apis/youtube/overview.html

Link to comment
https://forums.phpfreaks.com/topic/201256-youtube-security/#findComment-1055824
Share on other sites

ok im confused lol  :-\

 

ignace's way is the best way to go. Read up on the link he provided. In other words you only need to store the information that that the youtube video requires.

 

We would be able to assist you further if we understood what you were trying to do with this? What are they submitting the video into? What are you doing with the video once its submitted? etc etc

Link to comment
https://forums.phpfreaks.com/topic/201256-youtube-security/#findComment-1055868
Share on other sites

You ask the user to input the Video ID (xFYQQPAOz7Y) afterwards when you want to display the video you do:

 

<object width="480" height="385">
  <param name="movie" value="http://www.youtube.com/v/<?php echo $vid; ?>"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="http://www.youtube.com/v/<?php echo $vid; ?>"
    type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
    width="480" height="385">
  </embed>
</object>

 

Personally I would extend this further so I could control which video had fullScreen and scriptAccess, the width and height of the video.

Link to comment
https://forums.phpfreaks.com/topic/201256-youtube-security/#findComment-1055874
Share on other sites

Ahh this works. i just wanted to uncomplicate things for the user. entering "

into a form box makes more practical sense for the user.

 

well if you want to do that all you have to do is remove the http://www.youtube.com/watch?v= with some string manipulation functions. I'm sure you can figure that part out ;)

Link to comment
https://forums.phpfreaks.com/topic/201256-youtube-security/#findComment-1055887
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.