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 - url or content as a variable in the header of the page -


i designing site external links form various being shown on page. using

$url=$_get['url']; $website_data = file_get_contents($url); echo $website_data; 

so user click on hyperlink www.test.com/display_page.php?url=http://www.xyz.com/article/2.jpg

my page, list_of_images.php, typically has list of images href each image above on page , when image clicked go display_page.php, show our banner on top of page, text , image beneath that. image website.

i sending url directly , grabbing using get. understand users/hackers can coding , send commands url variable , break server or harmful , avoid method or sending url directly in header. alternate approach problem?

i make sure url starts http:// or https://:

if(preg_match("`^https?://`i", $_get['url'])) // stuff 

you may want make sure isn't pointing anywhere internal:

if(preg_match('`^https?://(?!localhost|127\.|192\.|10\.0\.)`i', $_get['url'])) // stuff 

rather big dirty regex, go more elegant host black-list approach, drift...


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 -