I'm trying to figure out why this function does not work correctly.
It's adding an extra \
every time I edit my entries.
Online server has these settings:
magic_quotes_gpc On
magic_quotes_runtime Off
magic_quotes_sybase Off
Here is the code:
function esc($s)
{
if (get_magic_quotes_gpc()) {
if (ini_get('magic_quotes_sybase'))
$s = str_replace("''", "'", $s);
else
$s = stripslashes($s);
} //if
return mysql_real_escape_string($s);
}
Edit note:
I have tried completely removing this function to see what it does... and it does the same thing, so I have realized that addslashes
is also use in the code for the same thing.
The extra \
were there because magic_quote
was ON
Ok I have fixed the problem. A quick solution for now, I have removed function esc($s)
.
I changed Magic_Quote
to OFF in php.ini.
I'm keeping addslashes solution.