Code Returns PHP Array

Questions about programming languages and debugging
Post Reply
User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Code Returns PHP Array

Post by maboroshi »

I often go back to things when I have not figured them out entirely... A while back me and circuit where playing with code and by some misfortune discovered that this code

Code: Select all

<form method="post" action="<?= $_POST ?>">
<input type="submit" value="">
</form>
will result in the script searching for a File Object "Array" now normally a coder would regard this as useless info but being the malicious person I am I have no choice but to look into it further :evil:

Any one have any ideas

Im thinking that what the file object Array is looking for exists as a function in either the PHP or Apache server but I really don't know

Cheers Maboroshi

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Mab, $_POST in an array variable, so it holds no value itself, only the elements of the array do.
HTTP POST variables: $_POST

Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS.

An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope.

This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.

$HTTP_POST_VARS contains the same initial information, but is not an autoglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)

If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
¯\_(ツ)_/¯ It works on my machine...

Post Reply