Disable Magic quotes on MySql DB


#1

hi, is possible to disable Magic quotes to use the apex on MySql DB without error?

PHP.ini configuration not work
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

.htaccess not work
php_flag magic_quotes_gpc Off


#2

How did you modify your PHP.ini configuration? Did you use the ExeOutput’s PHP.INI page?


#3

yes, i have modified the php.ini in ExeOutput setting and i have also test the disable magic_quotes with .htaccess without no result. i have tested a project with magic_quotes_gpc = On in php.ini and the exe file do not startup.

php version 5.6

any idea?


#4

if it were possible to enable magic quote in php.ini we could use this runtime solution (source from php.net). With web server environments it works fine.

this is the solution that we could use directly in php files

if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}


#5

.htaccess is not supported in ExeOutput. It’s only for Apache.

Anyway, it looks like your code will never work in PHP 5.6 since from PHP docs it is said
5.4.0 get_magic_quotes_gpc always returns FALSE because the magic quotes feature was removed from PHP.


#6

hi, maybe you didn’t understand what I needed: I needed to use quotes without managing them by php code for all forms used.

I solved by including this code in the pages:

$ _POST = array_map (‘addslashes’, $ _POST);

Thank you