Reply to Re: Strategy for securing MySQL PHP application - please comment

Your name:

Reply:


Posted by Harold Crump on 07/05/06 00:44

Hi Rik --

> > My question - is it enough to pass all user input through the
> > htmlentities() function call and store the resultant output?
>
> No. Use mysql_real_escape_string(), allthough that's not a 100% secure
> either:
> http://ilia.ws/archives/103-mysql_real_escape_string-versus-Prepared-Statements.html

My understanding is that htmlentities replaces all types of quotes with
its HTML equivalent - doesn't that get rid of the whole problem with
escaping, or not escaping, quotes?

What's the issue with storing the &quote in the database?

Why bother with mysql_real_escape_string and all its inherent issues if
we can completely eliminate quotes from making their way into the SQL
statement?

What am I missing?

> Prepared statements seem the way to go. Use mysqli if available.

Aren't they available only with version 5 and above?
I am still on an older version.

> > Also, I would like to replace all semi-colons in input with something
> > else - but I am not sure what and how.
>
> Why?

Semi-colons are statement terminators in SQL.
They are commonly used in SQL injection attacks to end the current
statement and insert a malicious statement.

-Harold.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация