Posted by J.O. Aho on 02/07/06 03:20
Bernie Woodham wrote:
> Hello again. Hope you don't get sick of this. But the site that the code
> DOES work on provides REMOTE_ADDR in the ENV settings.
>
> But the site that the code does NOT work on does NOT have REMOTE_ADDR in
> the ENV settings. Although it does have REMOTE_ADDR in the PHP Variable
> settings for "_SERVER["REMOTE_ADDR]"
The $ENV is part of the old PHP, $_SERVER is one of the variables that has
replaced it in newer PHP. Another thing you will most likely encounter is that
global variables has been turned off by default.
In old PHP you could just define a variable in a form like
<input type="text" name="txtvar">
And in the script that was called of the form you could then just use $txtvar
at once and it contained the text the user had typed. This don't work anymore,
you need to manually set the variable
--- the script called by the form ---
$txtvar=$_POST['txtvar'];
--- end of example ---
This for increase the security of PHP scripts, as otherwise there is a risk
that variables can be overwritten by the user and in worst case gain access to
things they shouldn't.
> Could this be the reason? And if is there a way to alter the code to make
> it work?
There is example of modifications in the answer for the other post in this thread.
//Aho
[Back to original message]
|