Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - Validating/Allowing YouTube Embed Code -


hopefully simple question. have simple custom forum on site written in php. security reasons don't allow html in forum posts. allow bbcode tags. allow embedded youtube videos.

so question this: what's best (most secure) way validate youtube embed code? youtube using iframes embed videos, can't allow iframe tag. need ensure src of iframe youtube url, , ensure there's no other malicious bits of code in iframe code.

you should allow users use this:

[youtube]http://www.youtube.com/watch?v=te-til9yvae[/youtube] 

and turn embed code using php when displaying message:

function bb_youtube($post) {     return preg_replace(                             "#\[youtube].*?v=([^&]+).*?\[/youtube\]#im",                             '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/$1?fs=1"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$1?fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>',                             $post                            ); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -