[SOLVED] forums have globals on, why?
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I'd recommend not using $_REQUEST, because it's a merger of $_GET, $_POST and $_COOKIE. The problem lies in what order the elements get set in, which can vary from installation to installation.
If you want to support such a mechanism, I'd suggest rolling your own version so you know the order of creation.
If you want to support such a mechanism, I'd suggest rolling your own version so you know the order of creation.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
function getRequest()
{
$vars_to_pull_from = array('_GET' , '_POST');
reset($vars_to_pull_from);
$output = array();
while(list(,$var) = each($vars_to_pull_from))
{
reset($$var);
while(list($k,$v) = each($$var))
if(!isset($output[$k])) $output[$k] = $v;
}
return $output;
}the order you want the data is how $vars_to_pull_from is set up. So, if you want $_POST vars set first, you set it first in the array and so on..
Warning: Variable passed to reset() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 8
Warning: Variable passed to each() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 9
Warning: Variable passed to reset() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 8
Warning: Variable passed to each() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 9
i'm working on it.
Warning: Variable passed to each() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 9
Warning: Variable passed to reset() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 8
Warning: Variable passed to each() is not an array or object in c:\apache\htdocs\adven\develop\f.php on line 9