How can I eliminate undefined variables with register_globals turned on?

My website has register_globals turned on. With register_globals turned on, the variable declaration could be anywhere in the site. I am trying to clean up my Notices in the php-error.log file but I am unsure what would be the best approach.

Here’s a sample Notice

PHP Notice:  Undefined variable: arc_dttm in E:\pm\www\main\ts_data.php

arc_dttm is defined in another php file. Because of register_globals, the value is available in my ts_data.php file.

Here’s the line of code in the ts_data.php file

if($j==3||$j==5||$j==6||$j==7||$arc_dttm ||$tabPerm=='R') $readonly = 1;

Should I simply add isset() to each section of code that causes an undefined variable notice? For example,

if($j==3||$j==5||$j==6||$j==7|| (isset($arc_dttm) && $arc_dttm ) ||$tabPerm=='R') $readonly = 1;

Thanks for your advice.

The only advice I feel comfortable giving is: change host

I can do three things. 1) Ignore the huge error file. 2) Hide the notifications 3) Fix the notifications.

Sponsor our Newsletter | Privacy Policy | Terms of Service