Seite 1 von 1
register_globals im script ändern
Verfasst: 14.04.2005 23:12
von r4bbIt
Hi,
ich habe eine frage und zwar ich möchte das in einem Script der wert von register_globals im Script ändern bzw am Anfang des Scripts auf off schalten.
Ich hab mir gedacht das man das Script dann auch auf Servern mit register_globals = on benutzen "kann", so wie ich mir das gedacht habe.
hätte gedach das das mit ini_set() funzt aber irgentwie klappt das nicht so wie es sollte.
geht das überhaubt?
Verfasst: 14.04.2005 23:21
von PhilippK
Geht nicht - siehe
http://de2.php.net/manual/en/ini.php#ini.list
Einen alternativen Weg findest du in der common.php von phpBB 2.0.13 - einfach die Variablen deinitialisieren.
Gruß, Philipp
Verfasst: 16.04.2005 11:39
von r4bbIt
So da bin ich wieder, hatten diesen Post irgentwie total vergessen
meinst du diesen Teil?
Code: Alles auswählen
if (@phpversion() < '4.0.0')
{
// PHP3 path; in PHP3, globals are _always_ registered
// We 'flip' the array of variables to test like this so that
// we can validate later with isset($test[$var]) (no in_array())
$test = array('HTTP_GET_VARS' => NULL, 'HTTP_POST_VARS' => NULL, 'HTTP_COOKIE_VARS' => NULL, 'HTTP_SERVER_VARS' => NULL, 'HTTP_ENV_VARS' => NULL, 'HTTP_POST_FILES' => NULL, 'phpEx' => NULL, 'phpbb_root_path' => NULL);
// Loop through each input array
@reset($test);
while (list($input,) = @each($test))
{
while (list($var,) = @each($$input))
{
// Validate the variable to be unset
if (!isset($test[$var]) && $var != 'test' && $var != 'input')
{
unset($$var);
}
}
}
}
else if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
// PHP4+ path
$not_unset = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_SERVER_VARS', 'HTTP_SESSION_VARS', 'HTTP_ENV_VARS', 'HTTP_POST_FILES', 'phpEx', 'phpbb_root_path');
// Not only will array_merge give a warning if a parameter
// is not an array, it will actually fail. So we check if
// HTTP_SESSION_VARS has been initialised.
if (!isset($HTTP_SESSION_VARS))
{
$HTTP_SESSION_VARS = array();
}
// Merge all into one extremely huge array; unset
// this later
$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
unset($input['input']);
unset($input['not_unset']);
while (list($var,) = @each($input))
{
if (!in_array($var, $not_unset))
{
unset($$var);
}
}
unset($input);
}
Verfasst: 17.04.2005 00:21
von Pyramide
Ja