Re: [SMARTY] get_magic_quotes_gpc problem : slashes - URGENT !
| From: | messju mohr | Date: | Tue, 08 Jul 2003 07:59:57 +0000 |
| Subject: | Re: [SMARTY] get_magic_quotes_gpc problem : slashes - URGENT ! | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9845@lists.php.net to get a copy of this message | ||
the magic is that php separates a copy of the value, when you write to
it. so, if you change $_POST[foo], the value of $HTTP_POST_VARS[foo]
stays the same, even if they both pointed to the same contents before.
"$HTTP_POST_VARS =& $_POST" makes HTTP_POST_VARS a *reference* to
$_POST. after that they point to the same elements and changing the
one, changes the other.
see: http://www.php.net/manual/en/language.references.php
for further
explanation.
On Tue, Jul 08, 2003 at 10:09:46AM +0300, Irfan Uygur - Pusula Bilisim ve Internet Hiz. Ltd. Sti.
wrote:
> Thanks a lot for the help messhu & david, that saved my day !
>
> Although I still can not understand the difference betw. $HTTP_POST_VARS & $_POST because
> they all
> point to the same thing, that trick worked to my surprise and I was able to modify post data
> before processed by
> smarty ...
>
> Irfan Uygur
>
>
>
>
> >>> -----Original Message-----
> >>> From: messju mohr [mailto:messju@lammfellpuschen.de]
> >>> Sent: 07 Temmuz 2003 Pazartesi 14:31
> >>> To: Irfan Uygur - Pusula Bilisim ve Internet Hiz. Ltd. Sti.
> >>> Cc: smarty-general@lists.php.net
> >>> Subject: Re: [SMARTY] get_magic_quotes_gpc problem :
> >>> slashes - URGENT !
> >>>
> >>>
> >>>
> >>> if you mean too many backslashes when using $smarty.post.* :
> >>>
> >>> all stable releases of smarty use $HTTP_*_VARS and not $_*-vars.
> >>> prepend a "$HTTP_POST_VARS =& $_POST;" before your
> >>> stripslashes-loop.
> >>>
> >>>
> >>> On Mon, Jul 07, 2003 at 02:02:33PM +0300, Irfan Uygur -
> >>> Pusula Bilisim ve Internet Hiz. Ltd. Sti. wrote:
> >>> > 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
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Smarty General Mailing List (http://smarty.php.net/)
> >>> > To unsubscribe, visit:
> >>> > http://www.php.net/unsub.php
> >>>
> >>> --
> >>> Smarty General Mailing List (http://smarty.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php‰¥qD$ë
> >>> ¿’Œs)Ç
> >>>
> >>>
> >>>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php