note 41247 added to security.registerglobals

From: Date: Sun, 04 Apr 2004 05:01:48 +0000
Subject: note 41247 added to security.registerglobals
Groups: php.notes 
Request: Send a blank email to php-notes+get-67605@lists.php.net to get a copy of this message
(I am the same person as electronerd@hotmail.com) Thank you for the correction. Updated code: <?php $var_list = get_defined_vars(); $safelist = array('_GET', '_POST', '_COOKIE', '_SERVER', '_ENV', '_FILES', '_REQUEST', '_SESSION'); foreach($var_list as $name => $value) { if(array_search($name, $safelist) === FALSE) { unset($$name); } } unset($var_list, $name, $value, $safelist); ?> As before, all you have to do to extend the list of variables to keep is to add them to $safelist (though, obviously, if you want to save $var_list, $safelist, $name, or $value, you're going to have to modify the script). ---- Manual Page -- http://www.php.net/manual/en/security.registerglobals.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41247 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41247&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41247&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67605) next »