Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a movies website. The data of the movie is retrieved from the database on the base of movie name. When Some user click on the movie name link a url of like this "php?moviename=Live Free Die Hard" is generated and the full information related to that movie is shown. My question is that I am using spaces between the name of the movie which is compulsory if I want to get the movie details on the basis of movie name, But is it a good and secure way? if not, what else way should i use?
Posted
Comments
Ankur\m/ 11-Apr-11 2:39am    
I don't think there will be any issue. But in such cases you should HtmlEncode the URL.
rashidfarooq 11-Apr-11 4:09am    
thanks for answering.

Look at this URL:

http://en.lmgtfy.com/?q=%22Live+Free+Die+Hard%22[^].

This is the way to escape the blank spaces. In this example it passes the search string to— just click it and you will see. I don't see any problem here. Yes, this is a secure way.

—SA
 
Share this answer
 
v2
Comments
rashidfarooq 11-Apr-11 4:09am    
thanks for answering.
Sergey Alexandrovich Kryukov 11-Apr-11 4:17am    
You're welcome.
Thanks for accepting the Answer.
Good luck.
--SA
Normally, spaces in a URL are a Bad Thing: you should do HTML encoding and decoding before you construct the URL completely. Look at what Google and so forth do: an ampersand is translated to "%26", a hash to "%23" and so forth. There are a range of characters your user could type or which could appear in a movie name which could potentially mess things up. Better to encode them and prevent problems.
 
Share this answer
 
Comments
rashidfarooq 11-Apr-11 4:09am    
thanks for answering
Sergey Alexandrovich Kryukov 11-Apr-11 4:16am    
Sure, a 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900