get_magic_quotes_gpc problem : slashes - URGENT !
| From: | Irfan Uygur - Pusula Bilisim ve Internet Hiz. Ltd. Sti. | Date: | Mon, 07 Jul 2003 11:02:33 +0000 |
| Subject: | get_magic_quotes_gpc problem : slashes - URGENT ! | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9841@lists.php.net to get a copy of this message | ||
Hi everyone,
I have finished my first project [not with php :) but with smarty] just now and while I was making
the final touched I just noticed
a problem :
problem with get_magic_quotes_gpc() settings. Thing that I type in form are escaped with
backslashes.
When a user types this in a textbox :
th'is is j"ust a te\st to see slashes problem
On the next page this is shown :
th\'is is j\"ust a te\\st to see slashes problem
You might say that this is an application logic problem not a presentation layer issue. But normally
I had done in all my previous
projects
the following which worked all the time :
while( list($k, $v) = each($_POST[$k]) )
{
$_POST[$k] = stripslashes($v);
}
which all worked like a charm now. I know that this might break-up dbase insert's but this is
just for showing on web pages, I do
seperate
precautions like addslashes for dbase inserts.
Althogh this must - and does- remove slashes from the post/get values, somehow still they are
escaped in smarty templates. I guess
somewhere
in the smarty class library, they are escaped again . And I am about to publish this project in a
live site tonight. Can somenone
advice me how to make
a quick fix ? Should I make a pre/post filter for this ? How do other people fix this problem in
their programs ? Any advice on this
issue will be greatly appriciated ...
Thanks in advance,
Regards,
Irfan Uygur