Gossamer Forum
Home : General : Internet Technologies :

$HTTP_POST_VARS

Quote Reply
$HTTP_POST_VARS
Hi...I'm just wondering if anyone had any idea on how to assign all the variables grabbed from $HTTP_POST_VARS to their own variables?

i.e $HTTP_POST_VARS['action'] would simply be called $action.

The reason I need to do this, is because it seems that some servers have a weird security feature installed, whereas they won't let you call variables like $action Frown

At the moment I have this code;

Code:
foreach($HTTP_POST_VARS as $thing => $var) {

$$thing = $HTTP_POST_VARS[$var];
echo "assigning \$$thing to $var <BR>";

}

Now, that doesn't seem to be working right, in assigning the variables.

Has anyone ever had to do this, and if so, would you mind sharing how?

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] $HTTP_POST_VARS In reply to
Never mind....turned out I needed to use $HTTP_GET_VARS...

Code:
// make sure we grab the variables we need...otherwise some servers will spew :D
foreach($HTTP_GET_VARS as $thing => $var) {
$$thing = $var;
}

foreach($HTTP_POST_VARS as $thing => $var) {
$$thing = $var;
}

I used both $HTTP_POST_VARS and $HTTP_GET_VARS, assigning both their own variables...

Smile

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] $HTTP_POST_VARS In reply to
It's called register_globals and is off by default now on new phps:

http://www.php.net/....registerglobals.php

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Andy] $HTTP_POST_VARS In reply to
If you do a lot of PHP work, you really should read over the WHOLE PHP manual; it's extremely useful, and you'll be surprised what things you'll find. If you did, you would have seen that there's an 'extract' function: http://php.net/extract.

Why are you doing this anyways? Having all post variables as globals isn't such a good idea (except for convenience).

Adrian
Quote Reply
Re: [brewt] $HTTP_POST_VARS In reply to
Yeah, but its finding the time to read through the whole manual Wink

Re why I need them as globals...

It was simply the fact I had writen the script thinking that all versions of PHP 4+ would use;

$var_name

rather than

$HTTP_POST_VARS['var_name'].

It worked on my server, and pretty much all the servers I tried it on....but I thought i would make some code up to assign non-array variables, so I dind't have to go through all 50 files, and update all the variable calls Tongue

Thanks guys

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates