Re: [PHP] php 5 and register_globals=off gives lotsa errors





It's NOT register_globals being off.

It's E_NOTICE being on.

You could turn E_NOTICE off and *ignore* these errors -- They are
still there, you are just ignoring them.

Or you could fix the script:

$action = isset($_GET['action']) ? $_GET['action'] : '';

would be the replacement line for your first example.

On Sat, December 30, 2006 7:21 pm, Wikus Moller wrote:
Hi to all.

I am having huge problems running my script, which worked fine on a
server with php 4 and register_globals turned on, on a server with php
5 and register_globals turned off.

I get errors around the area in my script where I use $_GET (not the
only error). For example the following code on my index.php file which
like many other sites I know, handles quite a large amount
if(action=="main"); etc etc. :

<?
$action = $_GET["action"]; //line 55
$sid = $_GET["sid"]; //line 56
$page = $_GET["page"]; //line 57
$who = $_GET["who"]; //line 58
?>

When I go to http://chillinglounge.net (where the error is located) I
get the following error message(s):

Notice: Undefined index: action in
C:\websites\chillinglounge.net\public_html\index.php on line 55

Notice: Undefined index: sid in
C:\websites\chillinglounge.net\public_html\index.php on line 56

Notice: Undefined index: page in
C:\websites\chillinglounge.net\public_html\index.php on line 57

Notice: Undefined index: who in
C:\websites\chillinglounge.net\public_html\index.php on line 58

Now if you would look at exactly the same script at
http://ranterswap.net you'd see absolutely no errors.

That's where I need your help. I know what is causing this error. I
believe it's the fact that register_globals is turned off.

But what I really want to know is: How do I fix it without trying to
turn register_globals on via .htaccess (because it doesn't work)?

Is there a function or some magic script that would to the trick?
Or do I have to recode my entire script and how?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: Bug in #! processing - "pear broken on current"
    ... on the cvs-src mailing list...] ... script is due to the change in parsing I committed on May 28th. ... php would have been started up with: ... /usr/bin/env could be used to fix this, once I write up that change... ...
    (freebsd-arch)
  • Re: variable problem in address book script
    ... fix old stuff. ... I really don't know anything about PHP except what I picked up over the past ... I found another address book script that pretty much worked out of the box. ... A couple error messages that were fixed with your suggestions for the ...
    (alt.php)
  • Re: Notice: Undefined index:..
    ... stored in a MySQL database. ... BUT: The script won't work!!! ... I get this error message when i run the ... Notice: Undefined index: action in ...
    (php.general)
  • Re: [PHP] php 5 and register_globals=off gives lotsa errors
    ... warning level in your PHP 4 setup and you will see exactly the same ... server with php 4 and register_globals turned on, ... I get errors around the area in my script where I use $_GET (not the ... Notice: Undefined index: action in ...
    (php.general)
  • Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net
    ... that was something that I forgot to fix in the blast that ... the script sent out (due to a problem between the chair and the ... I hadn't realized that Stas had one (or that PHP had one at all, ...
    (php.general)