Re: Stripslashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 14 January 2007 12:01 am, Jim Lucas wrote:

> This is what I use, and it has worked ever time.
>
> if ( get_magic_quotes_gpc() ) {
>   $_POST = array_map("stripslashes", $_POST);
> }
>
> Jim Lucas

That will break as soon as you submit an array back through a POST request, 
which I do rather often. :-)  You need to iterate over the array, and if an 
item is an array, iterate over it recursively.  array_walk() can be useful 
here.

Of course, the real answer is to disable magic quotes in the first place as 
they are spawn of Satan.  If you're using a web host that doesn't let you do 
so, get a real web host.  

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux