Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
php register globals on/off how/why
Name: huummmm Date: November 25, 2004 at 15:01:48 Pacific OS: win2000 CPU/Ram: 512
Comment:
Hi all. I'm pretty new to php and am just after a few hints if poss. I'm just trying out some simple scripts using global variables (i.e. $REMOTE_ADDR) etc. and i'm getting errors 'Notice: Undefined variable: REMOTE_ADDR in c:\Inetpub\wwwroot\INDEX.php on line 22'. I've read a little into this and am I right in saying that this is down to the register globals being set to off (i'm using php 5 by the way). Thanks for any help. Owen
Name: -Bryan- Date: November 25, 2004 at 16:58:38 Pacific
Reply:
To answer the why...register globals being on is a security mess waiting to happen, as global variables can ultimately be overwritten using malicious script, etc.
Try using $_SERVER['REMOTE_ADDR']array instead.
0
Response Number 2
Name: FBI Agent Date: November 29, 2004 at 07:58:04 Pacific
Reply:
also, if you have a lot of variables on your forms it slows them down because they have to create a useless variable for each piece on the form whether or not it will be used. reg globals are for lazy loser web-designers, if you want them on you shouldnt be making websites. but yeah, for the newer versions of php you do what bryan mentioned. you should check out the phpinfo(). just do:
<?php echo phpinfo() ?>
and open the .php webpage. it will show a list of all the php stuff and at the bottom it will show you some predefined variables that you can use and what they mean.
Summary: Hello all. I've finally got my photo gallery up and running. I've verified that it does in fact work, but today I noticed a bunch of errors in my system event log. They all say the same thing which is...
Summary: register globals is a directive in your php.ini file. Leaving it off (which is default) actually can improve the clarity of your scripts. Perfect example - you had no idea where $PATH came from. Yo...
Summary: Hello, I have downloaded a POLL script from scriptme.com and I have set it up on my website(http://tormusayya.com/poll2/vote.php)and its working fine! One questions though! I want when I press "SHOW M...