note 66145 added to function.import-request-variables
| From: | samb06 at gmail dot com | Date: | Mon, 15 May 2006 23:09:31 +0000 |
| Subject: | note 66145 added to function.import-request-variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-111350@lists.php.net to get a copy of this message | ||
What i do is have a small script in my header file that takes an array called $input, and loops
through the array to extract variables. that way the security hole can be closed, as you specify
what variables you would like extracted
$input = array('name' => null, 'age' => 26) ;
// 26 is the default age, if $_GET['age'] is empty or not set
function extract_get()
{
global $input ;
if ($input)
{
foreach ($input as $k => $v)
{
if ($_GET[$k] == '' or $_GET[$k] == NULL)
{
$GLOBALS[$k] = $v ;
}
else
{
$GLOBALS = $_GET[$k] ;
}
}
}
}
----
Server IP: 64.71.164.2
Probable Submitter: 70.21.67.186
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.import-request-variables.php
Edit -- http://master.php.net/note/edit/66145
Del: integrated -- http://master.php.net/note/delete/66145/integrated
Del: useless -- http://master.php.net/note/delete/66145/useless
Del: bad code -- http://master.php.net/note/delete/66145/bad+code
Del: spam -- http://master.php.net/note/delete/66145/spam
Del: non-english -- http://master.php.net/note/delete/66145/non-english
Del: in docs -- http://master.php.net/note/delete/66145/in+docs
Del: other reasons-- http://master.php.net/note/delete/66145
Reject -- http://master.php.net/note/reject/66145
Search -- http://master.php.net/manage/user-notes.php