You are here: Re: stripslashes vs quotes « PHP Programming Language « IT news, forums, messages
Re: stripslashes vs quotes

Posted by Michael Fesser on 07/24/07 11:10

..oO(Sergei Riaguzov)

>Well then I will ask a lamer question, what is the best way to deal with
>situation when you have a textarea in a form and some text in some other
>place on the page, and everything which is written in the form is send to
>the same page via POST to the same textarea which produces slashes?

Slashes are produced by magic quotes, an old and absolutely broken
concept. Thankfully it will be removed in PHP 6. But for now you have to
call get_magic_quotes_gpc() to check if MQs are enabled. If that's the
case, call stripslashes() on the POST or GET values to get the raw data.
That's what you should always work with.

Then, when printing something out to an HTML page again, run it through
htmlspecialchars() to take care of these special chars that might break
your HTML (<, & and ").

Micha

 

Navigation:

[Reply to this 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

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