I am trying to implement a system that will let a user submit a video link and then display the video but I am having a little bit of difficulty. I tried submitting the whole object video into database, but when I use mysql_real_escape_string, it leaves the link unusable because it adds \" and escapes quotations. However, if I was to just use the link of the site I wouldn't know how to identify the post as a video.
Does anyone know the process sites like digg and reddit use to ensure the video is displayed correctly, can be identified as a video, and will support embeds from different sites? If anyone is an expert on this, I would really appreciate any suggestions.
Thanks in advance
Does anyone know how sites like reddit let users embed video
Moderator: General Moderators
-
scarface222
- Forum Contributor
- Posts: 354
- Joined: Thu Mar 26, 2009 8:16 pm
-
scarface222
- Forum Contributor
- Posts: 354
- Joined: Thu Mar 26, 2009 8:16 pm
Re: Does anyone know how sites like reddit let users embed video
nvm i used striplashes on the submitted object link. If anyone has anything to add though I would still really appreciate it.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Does anyone know how sites like reddit let users embed video
The problem with the slashes is that you have magic_quotes turned on. So when the data is posted, PHP automagically adds the slashes, then you do it again with mysql_real_escape_string(). You should either turn off magic_quotes, or run stripslashes() before running mysql_real_escape_string().
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
scarface222
- Forum Contributor
- Posts: 354
- Joined: Thu Mar 26, 2009 8:16 pm
Re: Does anyone know how sites like reddit let users embed video
thanks man I looked into that, I am not exactly sure what the point of the quotes are (prevent developers from being prone to injection, i thought mysql_real_escape_string did that?) but they are apparently removed in php 6. I just have one more question. In large resolutions, the page is fine but it extends a bit farther then it should, so I looked at the object, and it seems there is a large variety of widths and height possibilities, so I wanted to use a uniform height and width for all videos, but since youtube and vimeo players for example are different embed links, should I just try to use preg replace to match all resolution possibilities on youtube and replace with a moderate sized one? Any suggestions on that?