note 82542 added to security.globals
| From: | Dice at osu1 dot php dot net | Date: | Wed, 16 Apr 2008 04:46:36 +0000 |
| Subject: | note 82542 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138345@lists.php.net to get a copy of this message | ||
To expand on the nice bit of code Mike Willbanks wrote and Alexander tidied up, I turned the whole
thing in a function that removes all the globals added by register_globals so it can be implemented
in an included functions.php and doesn't litter the main pages too much.
<?php
//Undo register_globals
function unregister_globals() {
if (ini_get(register_globals)) {
$array = array('_REQUEST', '_SESSION', '_SERVER', '_ENV',
'_FILES');
foreach ($array as $value) {
foreach ($GLOBALS[$value] as $key => $var) {
if ($var === $GLOBALS[$key]) {
unset($GLOBALS[$key]);
}
}
}
}
}
?>
----
Server IP: 83.137.20.135
Probable Submitter: 80.127.25.210
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- https://master.php.net/note/edit/82542
Del: integrated -- https://master.php.net/note/delete/82542/integrated
Del: useless -- https://master.php.net/note/delete/82542/useless
Del: bad code -- https://master.php.net/note/delete/82542/bad+code
Del: spam -- https://master.php.net/note/delete/82542/spam
Del: non-english -- https://master.php.net/note/delete/82542/non-english
Del: in docs -- https://master.php.net/note/delete/82542/in+docs
Del: other reasons-- https://master.php.net/note/delete/82542
Reject -- https://master.php.net/note/reject/82542
Search -- https://master.php.net/manage/user-notes.php