note 50201 deleted from function.ini-set by philip

From: Date: Tue, 05 Apr 2005 21:37:51 +0000
Subject: note 50201 deleted from function.ini-set by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87538@lists.php.net to get a copy of this message
Note Submitter: php_net+NOSPAM at lazur dot com ---- mike at dthought dot net had a good idea for faking "ini_set(register_globals, 0)" but I was unable to get it to work. The $get_key variable needed to be eval'd in order to unset the proper key in the $_GET array. Here's my fixed version that will unset register globals for the $_GET, $_POST and $_REQUEST arrays _if_ register_globals are enabled: <?php // Effectively turn off register_globals without having to edit php.ini if (ini_get(register_globals)) { // If register globals are enabled // Unset $_GET keys foreach ($_GET as $get_key => $get_value) { eval("unset(\${$get_key});"); } // Unset $_POST keys foreach ($_POST as $post_key => $post_value) { eval("unset(\${$post_key});"); } // Unset $_REQUEST keys foreach ($_REQUEST as $request_key => $request_value) { eval("unset(\${$request_key});"); } } ?>

« previous php.notes (#87538) next »