note 33849 deleted from language.variables.external by danbrown
| From: | danbrown@php.net | Date: | Wed, 09 Mar 2011 14:42:41 +0000 |
| Subject: | note 33849 deleted from language.variables.external by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177711@lists.php.net to get a copy of this message | ||
Note Submitter: nospam at thenerdshow dot calm
----
you can convert old code to work with register_globals=off without sacrificing security. Or maybe
you like working with variables the old way better. I know I do!
I looked all over for something like this so here it is:
$expected=array(
'name', // Only accept these variables from a submit!
'email',
'favorite_color'
); for ($i=0;$i < count($expected);$i++)
$$expected[$i] = (isset($_GET[$expected[$i]]))?$_GET[$expected[$i]]:NULL;
// This is a test.
echo "Name: $name<br>";
echo "Email: $email<br>";
echo "Fav. Color: $favorite_color<br>";