note 55196 deleted from function.get-magic-quotes-gpc by philip

From: Date: Tue, 27 Jun 2006 06:39:12 +0000
Subject: note 55196 deleted from function.get-magic-quotes-gpc by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114346@lists.php.net to get a copy of this message
Note Submitter: ---- Depending the server config, magic-quotes are the better thing to make unportable scripts, they are *evil*. So I systematicaly execute the following undo_magic_quotes( ), then I simply use mysql_real_escape_string( ), htmlentities( ), etc. when I need. <?php function undo_magic_quotes( ) { if ( get_magic_quotes_gpc( ) ) { $_GET = array_map_recursive('stripslashes', $_GET) ; $_POST = array_map_recursive('stripslashes', $_POST) ; $_COOKIE = array_map_recursive('stripslashes', $_COOKIE) ; $_REQUEST = array_map_recursive('stripslashes', $_REQUEST) ; } } if ( ! function_exists('array_map_recursive') ) { function array_map_recursive($function, $data) { foreach ( $data as $i => $item ) { $data[$i] = is_array($item) ? array_map_recursive($function, $item) : $function($item) ; } return $data ; } } ?>

« previous php.notes (#114346) next »