README.md

December 4, 2022 · View on GitHub

register_globals workaround

Description

since PHP version 4.2.0 you can no longer pass variables from one page to the other with a form without using the super-global variables POSTor_POST or _GET.

These were introduced for security reasons, but it makes upgrading your old scripts a pain.

imagine having to go through all the files on your server, changing hundreds of variables...

with this script this problem is gone in no time.

More Info

Submitted On
Bylixlpixel
LevelBeginner
User Rating3.8 (15 globes from 4 users)
CompatibilityPHP 4.0
CategoryCoding Standards
WorldPHP
Archive File

Source Code

put following code
&lt;?<pre>
if ( phpversion() >="4.2.0") extract($_POST);
?>
</pre>
or if you're not sure where your variables come from
&lt;?<pre>
if ( phpversion() >= "4.2.0")
{
 extract($_POST);
 extract($_GET);
 extract($_SERVER);
 extract($_ENV);
 extract($_COOKIE);
}
?>
</pre>
on top of your old script
(or better put it in a file included in every page of your script)
and you're all set.
(sometimes life can be sooo easy)