[SOLVED] Post vars
Moderator: General Moderators
[SOLVED] Post vars
I am doing work on some pages on a server that is php 4.0.6 and mine is 4.1.2. On my server i can go $_POST[value] on theirs it will not work. Neither will adding a ' or a " around value. I can however do $HTTP_POST_VARS[value]. What can I tell this person to do to make it so that the $_POST works?
Help is appreciated.
Help is appreciated.
Ooooo I know this one... I have servers of same spec... it's annoying ain't it...
Ok, several questions:
1) Do you admin the server... ie do you have access to the php.ini file?
2) is the an standard include file that is included in all of their scripts... if so try:
Ok, several questions:
1) Do you admin the server... ie do you have access to the php.ini file?
2) is the an standard include file that is included in all of their scripts... if so try:
Code: Select all
<?php $_POST = $HTTP_POST_VARS; ?>Ok, well the php.ini file edit of auto_prepend is out if u don't have access to thephp.ini file... oh well...
What I meant be no. 2 is....
I have scipts in a web site that ALL include a series of standard files, such as:
initialise.php - contains all the initialisation of sessions, cookies, variables, db connections etc.
header.php - contains the header for the html
footer.php - need i explain
initialise.php is included at the begining of every script in my site, so a skeletal page would look a bit like:
So if you had any files like that then you could just make the first line the statement I mention above
What I meant be no. 2 is....
I have scipts in a web site that ALL include a series of standard files, such as:
initialise.php - contains all the initialisation of sessions, cookies, variables, db connections etc.
header.php - contains the header for the html
footer.php - need i explain
initialise.php is included at the begining of every script in my site, so a skeletal page would look a bit like:
Code: Select all
<?php
require_once $HTTP_SERVER_VARS["DOCUMENT_ROOT"]."/include/initialise.php";
require_once $HTTP_SERVER_VARS["DOCUMENT_ROOT"]."/include/footer.php";
// ALL code goes here
require_once $HTTP_SERVER_VARS["DOCUMENT_ROOT"]."/include/footer.php";
?>Your problem is not an ini configuration; rather the server version.
$_POST was added to PHP in 4.1.0.
http://www.php.net/manual/en/reserved.v ... ables.post
$_POST was added to PHP in 4.1.0.
http://www.php.net/manual/en/reserved.v ... ables.post
I suggest telling the server admin to upgrade to a newer version.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.
Ahh. so i change this line.
to
??
I do have access to the file and I can add anything that needs to be added.
Code: Select all
auto_prepend_file =Code: Select all
auto_prepend_file = $_POST = $HTTP_POST_VARS;I do have access to the file and I can add anything that needs to be added.
I believe that ini setting includes a file within all the pages on the server.
It's been a while since I used it and I can't find info within the manual about it. I might be a bit off with the info below...
So auto_prepend_file = /postvarsupdate.php would fix your problem if that page contained something like this:
As is says in the quote above; "You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS."
Wouldn't that cause some issues with scripts that don't use global $_POST; or global $HTTP_POST_VARS; after a function definition? I'd guess so.
It's been a while since I used it and I can't find info within the manual about it. I might be a bit off with the info below...
So auto_prepend_file = /postvarsupdate.php would fix your problem if that page contained something like this:
Code: Select all
<?php
$_POST = $HTTP_POST_VARS
?>Wouldn't that cause some issues with scripts that don't use global $_POST; or global $HTTP_POST_VARS; after a function definition? I'd guess so.