note 85447 added to security.globals
| From: | bohwaz at osu1 dot php dot net | Date: | Sun, 31 Aug 2008 21:39:07 +0000 |
| Subject: | note 85447 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144030@lists.php.net to get a copy of this message | ||
<?php
// Unregister_globals: unsets all global variables set from a superglobal array
// --------------------
// This is useful if you don't know the configuration of PHP on the server the application
// will be run
// Place this in the first lines of all of your scripts
// Don't forget that the register_global of $_SESSION is done after session_start() so after
// each session_start() put a unregister_globals('_SESSION');
function unregister_globals()
{
if (!ini_get('register_globals'))
{
return false;
}
foreach (func_get_args() as $name)
{
foreach ($GLOBALS[$name] as $key=>$value)
{
if (isset($GLOBALS[$key]))
unset($GLOBALS[$key]);
}
}
}
unregister_globals('_POST', '_GET', '_COOKIE', '_REQUEST',
'_SERVER', '_ENV', '_FILES');
?>
----
Server IP: 217.174.223.124
Probable Submitter: 82.225.170.198
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- https://master.php.net/note/edit/85447
Del: integrated -- https://master.php.net/note/delete/85447/integrated
Del: useless -- https://master.php.net/note/delete/85447/useless
Del: bad code -- https://master.php.net/note/delete/85447/bad+code
Del: spam -- https://master.php.net/note/delete/85447/spam
Del: non-english -- https://master.php.net/note/delete/85447/non-english
Del: in docs -- https://master.php.net/note/delete/85447/in+docs
Del: other reasons-- https://master.php.net/note/delete/85447
Reject -- https://master.php.net/note/reject/85447
Search -- https://master.php.net/manage/user-notes.php