note 33849 added to language.variables.external
| From: | nospam at rack1 dot php dot net | Date: | Wed, 09 Jul 2003 10:57:55 +0000 |
| Subject: | note 33849 added to language.variables.external | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51767@lists.php.net to get a copy of this message | ||
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>";
----
Manual Page -- http://www.php.net/manual/en/language.variables.external.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33849
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33849&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33849&report=yes