this is php4
function escape($message)
{
$find=array("_",'?','$',"!","&","%","'",'"');
$replace=array("\_","\?",'\$',"\!","\&","\%","\'",'\"');
return str_replace($find,$replace,$message);
}
$messageready = escape($message);
Part of the script relies on magic_quotes_gpc On On
While another part relies on the htaccess command: php_flag magic_quotes_gpc off
(preg_match to see quotations -- which I cannot redo for some time)
However lately -- discovered that doing an INSERT on $messageready is omitting the slashes. While doing a PRINT on $messagesready gives the backslash before the insert.
But the problem is that the phpinfo seems to have propogated since development, months ago,
from:
magic_quotes_gpc On On
to:
magic_quotes_gpc Off On // do to htaccess command
Question: will placing a php.ini file with 'magic_quotes_gpc On On' within that same script folder do it? Also, will it too propogate into local 'off' position?
Is there an easier, simpler way that addresses the above characters, realizing this will be done across multiple sites? mysql_real_escape_string does not address % and _ and this is a financial site.