This is a followup on the thread I've posted last week. The error which I had still persists. I'm working with HTML form and I'm using GET to .php file. Have you guys worked with $HTTP_*_VARS? This is where my problem is, a user selects one of the radio buttons named color on the HTML file and clicks on a button to submit the form. Depending on the radio button the user selected, .php file is going to change the bgcolor of the whole page using switch statement. One of the books I read talks about register_global in the php.ini file, do you guys know how to set this up?
"Globals" in laymans just means that you can access the same information just in a quicker way. ie, accessing $HTTP_POST_VARS['radio'] AKA $_POST['radio'] can be simply accessed as $radio.. This *technically* will have no effect on what you are trying to achieve as long as you code it appropriatly although this *can* open security risks. To finish up, in my opinion, you are better off having globals turned off.
On another note *Moderator Hat On* You are refering to a recent post you have made - what was wrong with that thread? What is the reason in creating a new thread?
"Globals" in laymans just means that you can access the same information just in a quicker way. ie, accessing $HTTP_POST_VARS['radio'] AKA $_POST['radio'] can be simply accessed as $radio.. This *technically* will have no effect on what you are trying to achieve as long as you code it appropriatly although this *can* open security risks. To finish up, in my opinion, you are better off having globals turned off.
On another note *Moderator Hat On* You are refering to a recent post you have made - what was wrong with that thread? What is the reason in creating a new thread?
Actually they are not synonomous. $HTTP_POST_VARS is merely a global array while $_POST is a superglobal. That means $HTTP_POST_VARS is not directly available from subroutines such as functions and classes.
Actually they are not synonomous. $HTTP_POST_VARS is merely a global array while $_POST is a superglobal. That means $HTTP_POST_VARS is not directly available from subroutines such as functions and classes.
Why do people still use $HTTP_POST_VARS?
I always use $_POST.
EDIT: ignore the following, I was confused by the example I was looking at in the manual.
$HTTP_POST_VARS requires that register_globals be enabled. As the default setting since PHP 4.2.0 is "off" for register_globals, thus essentially deprecating its use, for best script portability you should eschew the use of $HTTP_POST_VARS and instead use $_POST or $_GET as applicable.
Last edited by NogDog; 01-29-2007 at 02:13 PM.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Crap...my bad. I was looking at the 2nd example on this page and thought the comment that actually applies to the echo $username line applied to the $HTTP_POST_VARS line above the comment. I guess between the fact that I've always just used the $_POST array and hadn't finished my first cup of coffee when I wrote that conspired against me.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off
; Whether or not to register the old-style input arrays, HTTP_GET_VARS
; and friends. If you're not using them, it's recommended to turn them off,
; for performance reasons.
register_long_arrays = On
I think PHPBB and PHPBB2 are two of the reasons most servers still have those arrays enabled.
Bookmarks