RE: [PHP] Stripslashes & addslashes question ...
| From: | Johnson, Kirk | Date: | Sun, 24 Mar 2002 17:47:47 +0000 |
| Subject: | RE: [PHP] Stripslashes & addslashes question ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89917@lists.php.net to get a copy of this message | ||
Have you echo'd the variables before the addslashes() call, to be sure that
the stripslashes() call is being executed?
Kirk
> -----Original Message-----
> From: John Kelly [mailto:johnkelly@hotmail.com]
> Sent: Saturday, March 23, 2002 12:59 AM
> To: php-general@lists.php.net
> Subject: [PHP] Stripslashes & addslashes question ...
>
>
> Hi, can someone tell me why the following results in
> evaluated variables
> with 2 slashes in front of apostrophys instead of one and how
> I can modify
> it to only add 1? Thanks!
>
> foreach($_POST as $k=>$v){
> if (get_magic_quotes_gpc()){
> $_POST[$k] = stripslashes($v);
> }
> $_POST[$k] = addslashes($v);
> eval( "\$$k = \"$_POST[$k]\";" );
> }