Error Message using Saraotga PHP Bouy Data mesomap scripts

Hello All,
I have just placed a PHP script and related files onto my website to get dynamic, real-time data from the NDBC Buoy systems. The page comes up with the map and table ok, but i am getting a list of errors of undefined variables showing. Below is the printout of those messages. Also you can go to my site www.espwxctr.com and select Live Chesapeake Bay and you should see the errors along with the map and table… Any help would greatly be welcomed…

Notice: Undefined index: cvt in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 146

Notice: Undefined index: inc in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 148

Notice: Undefined index: sce in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 163

Notice: Undefined index: show in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 168

Notice: Undefined index: cfg in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 181

Notice: Undefined index: cache in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 187

Notice: Undefined variable: PHP_SELF in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 191

Notice: Undefined variable: myStatus in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 833

Notice: Undefined offset: 1 in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 848

Notice: Undefined index: show in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 215

Notice: Undefined variable: PHP_SELF in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 220

Notice: Undefined variable: otherParms in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 220

V/R,

Jim

Well to be of much help I think we need to see the script source, there is obviously a problem of some sort. I guess one question could be what level of PHP is on your server and what level was the script coded for? I have seen some strange issues with scripts coded for PHP 4 and run on PHP 5!

Stuart

I use the script exactly as it is downloaded and have no problems so wonder if you changed anything that might be the cause. Remember that you need to use notepad or similar to make changes rather than frontpage or such.

As suggested your ISP may not support the version of php that ken used.

You can find the scripts here…

http://saratoga-weather.org/scripts-buoy.php#buoydata

I used DreamWeaver to edit the script.

Also, I am using the PHP script for tropical weather RSS feed from the NHC with no problem. The script came from the same developer and web site.

Are you running your own web server? The errors appear to be related to paths located on a windows local machine?

-Bob

No. this is running on a web hosting services provided by my ISP.

It’s working fine for me now.

http://www.espwxctr.com/buoy-data.php

Working for me now as well :slight_smile:

-Bob

Yes. It should. I went through the script and eliminated the undefine variable errors. Seems to work fine now. Thanks for the inputs. If you still have any reason for the errors in the unmodified script. please let me know…

thanks!

Jim

You’re using an HTML editor to edit a text file? 8O

I did but switched to notepad and used the original script.

Most if not all of the errors relate to $_REQUEST or super globals, this must be a clue. It is expecting the variables to be passed on the url calling the script, the other odd errors may result from these failures. I’ve never used this so I’m guessing here. There are differences between function in PHP 4.1.0 and 4.3.0.

Stuart

Broadstairs is correct… most of the notices are generated from $_REQUEST items that aren’t on the calling of the script.

All of these are ‘Notice’ type messages which I never saw since my ISP’s default php.ini setting for error_reporting is E_ALL && ^E_NOTICE , so these messages didn’t show up for me.

For

Notice: Undefined index: cvt in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 146

Notice: Undefined index: inc in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 148

Notice: Undefined index: sce in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 163

Notice: Undefined index: show in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 168

Notice: Undefined index: cfg in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 181

Notice: Undefined index: cache in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 187

Notice: Undefined index: show in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 215

I should rewrite the code to use an if (isset($_REQUEST[‘…’]) first to avoid referring to a missing element.

The Undefined variable ones:

Notice: Undefined variable: PHP_SELF in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 191

Notice: Undefined variable: myStatus in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 833

Notice: Undefined offset: 1 in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 848

Notice: Undefined variable: PHP_SELF in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 220

Notice: Undefined variable: otherParms in D:\Webspace\resadmin\Jim\espwxctr.com\www\buoy-data.php on line 220

are likely due to setting these variables from ‘undefined’ vars previously.

You can ignore these kinds of messages by adding

 error_reporting(E_ALL && ^E_NOTICE);

I’ll try to update the source so Notices won’t appear (by adding the isset() function calls).

BTW jwyman, please feel free to email me directly if you have questions/comments/improvement suggestions on the Buoy-data script set.

Best regards,
Ken

The code is fixed and V1.04 is released – the only change in the buoy-data-V1-04.zip file is the buoy-data.php script itself. Download from:

http://saratoga-weather.org/scripts-buoy.php

The source for buoy-data.php was updated to use isset() for all associative array tests (on $_REQUEST and other program arrays). Also null defaults added for parsing the configuration file for optional parameters.
Uncomment line 13

// error_reporting(E_ALL);  // uncomment to turn on full error reporting

to enable full PHP error checking, and it should come out clean :slight_smile:

Thanks for spotting the issue jwyman – let me know if you find other scripts of mine that have problems!

Best regards,
Ken