Author Topic: Saratoga NOAA Image of the Day script  (Read 4417 times)

0 Members and 1 Guest are viewing this topic.

Offline lobsterman

  • Senior Contributor
  • ****
  • Posts: 164
    • Cape Small Harbor Weather
Saratoga NOAA Image of the Day script
« on: September 25, 2016, 11:35:30 AM »
Using the default settings in wxnoaaiod.php and get-nnvl-iod.php, I am getting these errors, both of which are a bit above my PHP pay grade. Could someone point me to what is going on here?

Quote
[25-Sep-2016 11:19:49 America/New_York] PHP Notice:  Undefined variable: VPuv in /home1/suiattl1/public_html/CapeSmallHarborWeather/mbridge/ajax-gizmo.php on line 206
[25-Sep-2016 11:19:49 America/New_York] PHP Parse error:  syntax error, unexpected '}' in /home1/suiattl1/public_html/CapeSmallHarborWeather/mbridge/get-nnvl-iod.php on line 48

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Saratoga NOAA Image of the Day script
« Reply #1 on: September 25, 2016, 11:40:59 AM »
That first line is just a notice, not a big deal, but the second one is what is causing your site to crash. Have you edited the code in any way? This can happen when you for example accidentally delete one quotation mark, semi-colon etc. Can you post the code you are using for this?

Offline lobsterman

  • Senior Contributor
  • ****
  • Posts: 164
    • Cape Small Harbor Weather
Re: Saratoga NOAA Image of the Day script
« Reply #2 on: September 25, 2016, 12:40:52 PM »
That first line is just a notice, not a big deal, but the second one is what is causing your site to crash. Have you edited the code in any way? This can happen when you for example accidentally delete one quotation mark, semi-colon etc. Can you post the code you are using for this?

It's the original get-nnvl-iod.php file from the Saratoga Base-USA distro. Too long to post here I think.

And I did not modify the wxnoaaiod.php in any way.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Saratoga NOAA Image of the Day script
« Reply #3 on: September 25, 2016, 01:01:42 PM »
OK, I downloaded the files, the error is in the get-nnvl-iod.php on line 48

which is very strange, because it is this line:

if (isset($_REQUEST['sce']) and strtolower($_REQUEST['sce']) == 'view' ) {
   //--self downloader --
   $filenameReal = __FILE__;
   $download_size = filesize($filenameReal);
   header('Pragma: public');
   header('Cache-Control: private');
   header('Cache-Control: no-cache, must-revalidate');
   header("Content-type: text/plain");
   header("Accept-Ranges: bytes");
   header("Content-Length: $download_size");
   header('Connection: close');
   
   readfile($filenameReal);
   exit;
}

There is also no other file included above it. One possibility is that the file got corrupted while being transferred to your website. Im sorry I guess I cant help because I dont know Saratoga that well, but you could try re-uploading that file.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9278
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga NOAA Image of the Day script
« Reply #4 on: September 25, 2016, 05:31:40 PM »
For the notice error in ajax-gizmo.php, you can change ajax-gizmo.php
Code: [Select]
           <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
to
Code: [Select]
<?php if(isset($VPuv)) { ?>         
   <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
<?php // optional UV code ?>

Regarding the get-nnvl-iod.php issue, it looks like that file is corrupted on your site.  running get-nnvl-iod.php?sce=view should result in a display of the complete source.  Download a copy of Base-USA.zip from my template site, extract the get-nnvl-iod.php and replace your current copy with that one, then upload to your site.. that should fix the issue.

Best regards,
Ken

p.s., Thanks, Jachym, for the assist :)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline lobsterman

  • Senior Contributor
  • ****
  • Posts: 164
    • Cape Small Harbor Weather
Re: Saratoga NOAA Image of the Day script
« Reply #5 on: September 26, 2016, 08:31:18 AM »
For the notice error in ajax-gizmo.php, you can change ajax-gizmo.php
Code: [Select]
           <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
to
Code: [Select]
<?php if(isset($VPuv)) { ?>         
   <span class="ajax" id="gizmouv"><?php echo $VPuv?></span>&nbsp;
   <span style="color: #ffffff">
         <span class="ajax" id="gizmouvword"><?php echo gizmo_get_UVrange($VPuv); ?></span>
   </span>
<?php // optional UV code ?>

Regarding the get-nnvl-iod.php issue, it looks like that file is corrupted on your site.  running get-nnvl-iod.php?sce=view should result in a display of the complete source.  Download a copy of Base-USA.zip from my template site, extract the get-nnvl-iod.php and replace your current copy with that one, then upload to your site.. that should fix the issue.

Best regards,
Ken

p.s., Thanks, Jachym, for the assist :)
Ken,

The ajax-gizmo fix worked.

The get-nnvi-iod.php suggestion also worked with a new download - odd. The IoD now displays though the error_log throws these lines:

Code: [Select]
[26-Sep-2016 08:22:56 America/New_York] PHP Notice:  Undefined offset: 4 in /home1/suiattl1/public_html/CapeSmallHarborWeather/mbridge/get-nnvl-iod.php on line 224
[26-Sep-2016 08:22:56 America/New_York] PHP Notice:  Undefined offset: 5 in /home1/suiattl1/public_html/CapeSmallHarborWeather/mbridge/get-nnvl-iod.php on line 226

Many thanks for the help.

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Re: Saratoga NOAA Image of the Day script
« Reply #6 on: September 26, 2016, 08:42:04 AM »
Unless this results in some direct error/problem on the page I wouldnt worry about these. Those are not errors or warnings, just notices so if you do not see any problem directly on the page do not worry about it and just ignore it in the code.

Offline lobsterman

  • Senior Contributor
  • ****
  • Posts: 164
    • Cape Small Harbor Weather
Re: Saratoga NOAA Image of the Day script
« Reply #7 on: September 26, 2016, 08:43:44 AM »
Unless this results in some direct error/problem on the page I wouldnt worry about these. Those are not errors or warnings, just notices so if you do not see any problem directly on the page do not worry about it and just ignore it in the code.

I appreciate the help Jáchym.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9278
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga NOAA Image of the Day script
« Reply #8 on: September 27, 2016, 02:57:48 PM »
The Notice errata were caused by a website change at the NNVL site.  I've updated get-nnvl-iod.php V1.16  27-Sep-2016 to handle it.

Use the update tool with Base-USA, Plugin-*, 27-Sep-2016 for the update.
Standalone users can use the script page for download.

The issue was in the grungy HTML on the page that included embedded \r\n delimiters, which caused the page to be truncated and the parsing for the text description of the image to fail.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Re: Saratoga NOAA Image of the Day script
« Reply #9 on: September 27, 2016, 06:55:56 PM »
Thanks, Ken!  =D&gt; =D&gt; =D&gt;
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Intheswamp

  • Early on one frosty morn'...
  • Forecaster
  • *****
  • Posts: 1485
  • Sure...I know enough to be dangerous, now.
    • Beeweather
Re: Saratoga NOAA Image of the Day script
« Reply #10 on: September 27, 2016, 09:19:16 PM »
It's amazing...you come here to WXForum to find out your site has a problem and the fix is already in.

Thanks Ken!!!!!

Ed

Davis VP2, v3.12
Cumulus v1.9.4  Build 1079
Today's weather beats no weather at all!
www.beeweather.com
www.beausandbonnets.com

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2432
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: Saratoga NOAA Image of the Day script
« Reply #11 on: September 28, 2016, 02:23:20 AM »
Unfortunately, I got an error with the new code and don't know how to fix it.   It's shown here:  http://stillwaterweather.com/noaaimage.php

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9278
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga NOAA Image of the Day script
« Reply #12 on: September 28, 2016, 10:51:38 AM »
The get-nnvl-iod.php script doesn't include any timezone setting -- it's expected that the calling page would have set the default timezone before the include("get-nnvl-iod.php") was done.

Just add
Code: [Select]
date_default_timezone_set("America/Chicago"); just before the include for the script and it should fix the issue.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Saratoga NOAA Image of the Day script
« Reply #13 on: October 23, 2016, 02:16:08 AM »
Hi Ken,

Another curve ball from NWS/NOAA...?

Code: [Select]
Notice: iconv(): Wrong charset, conversion from `UTF-8 <!DOCTYPE HTML PUBLIC ' to `ISO-8859-1//TRANSLIT' is not allowed in /home/dwayneya/public_html/wx/get-nnvl-iod.php on line 254

Notice: iconv(): Wrong charset, conversion from `UTF-8 <!DOCTYPE HTML PUBLIC ' to `ISO-8859-1//TRANSLIT' is not allowed in /home/dwayneya/public_html/wx/get-nnvl-iod.php on line 255

Notice: iconv(): Wrong charset, conversion from `UTF-8 <!DOCTYPE HTML PUBLIC ' to `ISO-8859-1//TRANSLIT' is not allowed in /home/dwayneya/public_html/wx/get-nnvl-iod.php on line 256
Sorry... today's image is a movie or animated .gif file and cannot be reformatted to show here. Please visit the NNVL site to view it.

This just popped up.

Thanks.
John
W7JKG

Offline Intheswamp

  • Early on one frosty morn'...
  • Forecaster
  • *****
  • Posts: 1485
  • Sure...I know enough to be dangerous, now.
    • Beeweather
Re: Saratoga NOAA Image of the Day script
« Reply #14 on: October 23, 2016, 08:19:37 AM »
John, I see you're running Weather Display.  I'm running Cumulus, so I'm not sure it's an apples to apples comparison but my IOD appears to be working fine this morning.  ????

Ed

Davis VP2, v3.12
Cumulus v1.9.4  Build 1079
Today's weather beats no weather at all!
www.beeweather.com
www.beausandbonnets.com

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5519
    • KomokaWeather
Re: Saratoga NOAA Image of the Day script
« Reply #15 on: October 23, 2016, 10:48:50 AM »
Hi Ed,
I am also getting errors and using Cumulus http://www.komokaweather.com/komokaweather-ca/wxnoaaiod.php
(I don't think the weather program has any impact on this).

Paul

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Saratoga NOAA Image of the Day script
« Reply #16 on: October 23, 2016, 03:55:41 PM »
This was the first time I'd seen an error about a movie or animated gif on the page. Of course that doesn't mean there hasn't been one there before.

The error text was actually taken from Silversword's page Mine shows text but still no image - http://tiggrweather.net/wxnoaaiod.php

Ed, I agree with Paul in that I don't think the software running matters, but thanks.

Thanks.
John
W7JKG

Offline Intheswamp

  • Early on one frosty morn'...
  • Forecaster
  • *****
  • Posts: 1485
  • Sure...I know enough to be dangerous, now.
    • Beeweather
Re: Saratoga NOAA Image of the Day script
« Reply #17 on: October 23, 2016, 09:03:23 PM »
Paul, from looking at your source code I *think* you are running a 2013 version of the php file....I'm running a 2016 version and it looks like it's working ok....???

Edited:  NOPE....what I saw relating to an old php file was commented out....we'll have to wait and see what Ken says...  #-o

Ed
« Last Edit: October 23, 2016, 09:05:35 PM by Intheswamp »

Davis VP2, v3.12
Cumulus v1.9.4  Build 1079
Today's weather beats no weather at all!
www.beeweather.com
www.beausandbonnets.com

Online PaulMy

  • Forecaster
  • *****
  • Posts: 5519
    • KomokaWeather
Re: Saratoga NOAA Image of the Day script
« Reply #18 on: October 23, 2016, 11:02:47 PM »
I found an updated script get-nnvl-iod.php
// Version 1.16 - 27-Sep-2016 - fixes for NNVL website design changes
and uploaded it and now seems to be working http://www.komokaweather.com/komokaweather-ca/wxnoaaiod.php.

Paul

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Saratoga NOAA Image of the Day script
« Reply #19 on: October 24, 2016, 12:21:09 AM »
I found an updated script get-nnvl-iod.php
// Version 1.16 - 27-Sep-2016 - fixes for NNVL website design changes
Exactly the script I'm running with the new error.
John
W7JKG

Offline Intheswamp

  • Early on one frosty morn'...
  • Forecaster
  • *****
  • Posts: 1485
  • Sure...I know enough to be dangerous, now.
    • Beeweather
Re: Saratoga NOAA Image of the Day script
« Reply #20 on: October 24, 2016, 08:13:12 AM »
I found an updated script get-nnvl-iod.php
// Version 1.16 - 27-Sep-2016 - fixes for NNVL website design changes
and uploaded it and now seems to be working http://www.komokaweather.com/komokaweather-ca/wxnoaaiod.php.

Paul
Since I set up my website I've been flying by the seat of my pants.  Without a *bunch* of folks here (including you, Paul) I would have crashed and burned long ago.  When you posted that you had updated the file and that it fixed the problem I went back and looked at the source code on my IOD page.  The reference to v1.16 was also commented out...I guess this is what happens when the php actually executes and presents the webpage to the viewer.  So who knows...I might have figured it out afterall!!!  That'd be a first!!! :lol:

Davis VP2, v3.12
Cumulus v1.9.4  Build 1079
Today's weather beats no weather at all!
www.beeweather.com
www.beausandbonnets.com

Offline Intheswamp

  • Early on one frosty morn'...
  • Forecaster
  • *****
  • Posts: 1485
  • Sure...I know enough to be dangerous, now.
    • Beeweather
Re: Saratoga NOAA Image of the Day script
« Reply #21 on: October 24, 2016, 08:14:40 AM »
I found an updated script get-nnvl-iod.php
// Version 1.16 - 27-Sep-2016 - fixes for NNVL website design changes
Exactly the script I'm running with the new error.
John, you might want to download another copy from Ken's website and give it another shot...the file could have an error in it for some reason....

Davis VP2, v3.12
Cumulus v1.9.4  Build 1079
Today's weather beats no weather at all!
www.beeweather.com
www.beausandbonnets.com

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Saratoga NOAA Image of the Day script
« Reply #22 on: October 24, 2016, 01:10:49 PM »
John, you might want to download another copy from Ken's website and give it another shot...the file could have an error in it for some reason....
Had already tried that but just did it again for both scripts - same problem.

The two graphics files in /cache/ do contain the correct image. FF just displays the text and Safari shows the text and the missing graphic icon (blue ? - attached).

Thanks.
John
W7JKG

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9278
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga NOAA Image of the Day script
« Reply #23 on: October 24, 2016, 04:27:48 PM »
John,
I think it's a firewall rule that's preventing the display of the image.  The image is at ./cache/IOD-image.jpg but instead of returning an image, it returns
Quote
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<h1>403 - Forbidden</h1>
<p>It is apparent that either you have not read RULE #1 - the first item in the nav bar, or you have chosen to ignore it. That is unfortunate, because it has put you here.</p>
<p>You no longer have permission to access this server.</p>
<p>Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.</p>
<p>If you are a bot you cannot read this anyway, but now you are a <em>blocked <strong>bad</strong> bot</em>.</p>
<p>If you are a human you have misused the system in one or more ways and got caught while doing so. This can include obvious hacking, camping on any page for extended periods of time (doing so has caused automatic throttling of this site by the server), etc. Needless to say - you are blocked.</p>
<p><strong>Note that your ISP has received a formal complaint regarding your abuse of this system.</strong></p>
<p>If you think the above is in error contact us and we will discuss it.</p>
<p>Referer - (none)<br />
IP - 24.5.140.48<br />
Host - tiggrweather.net</p>
</body>
</html>
Fix the firewall issue, and the image should display.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Saratoga NOAA Image of the Day script
« Reply #24 on: October 24, 2016, 05:04:47 PM »
Interesting that I do not see the 403 error on my site, nor have any changes been made to .htaccess there. The IOD page worked fine a few days ago and then just went to this problem. I see nothing that should take this page to the 403 error. Also, all the links on the page, including the one to the image, take me there successfully.

Guess I'll just delete the page.

Thanks, Ken.
John
W7JKG