Entry
Why do my (') are preceded by a (\) when I receive a message from my simple mail form?
Nov 28th, 2006 15:15
jean korte, Lee Jackson, Anna Filina,
With magic quotes turned off your form is vulnerable to other problems
-- that is why recent versions of PHP have magic quotes turned on by
default. Also, if you are using shared hosting, you likely don't have
the access suggested to turn them off.
The \ are escape characteres. They are inserted in front of characters
that have a special meaning to php so that php will know that you mean
just the ! character. Otherwise the ! is interpreted to mean 'not'.
What you do instead is to remove the additional \ before the message is
sent. Let's say that your message is in a variable called $message. To
remove the escape characters that php automatically added you simply do
the following:
$message = strip_slashes($message):
If you will be installing your script somewhere else and you don't know
if their implementation has magic quotes on or off, you simply check
this beforehand (this is a good idea incase someone changes your
installation and you are not aware of it)
if(get_magic_quotes_gpc()){$message=strip_slashes($message)};
jean
ps
fooling around with your .htaccess file if you don't understand how it
works can give you problems.
========================================================================
Simply go to the root folder of your site, then add this line into
the .htaccess file:
php_value magic_quotes_gpc 0
If you do not have a .htaccess file then simply do is and save it as a
txt file, then rename it.