> The title of this book doesn't really matter to "me"!
> 
> When I get that back, and read it from the file, it always 
> ends up like:
> 
> The title of this book doesn\'t really matter to \"me\"!
> 
> Note the addition of the escape sequences.  How can I stop 
> this? Is there some function in PHP? Or am I goign to have 
> to write a character routine to strip out escape sequences? 
> <shudder>

Very simple.

If magic_quotes_gpc is on, PHP does an addslashes() on all stuff
that comes in via HTTP GET, HTTP POST or a cookie. And, there's
a lovely function get_magic_quotes_gpc() that tells you its
status.

So:

if (get_magic_quotes_gpc())
{
  // Magic quotes is on, we don't want stuff escaped.
  $value = stripslashes($value);
}

This is handy to use in your script even if you know the way your
system is set up in php.ini - if you port your script to another
server that is set up differently, then it'll still work as you
expect.

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to