Author Topic: Help fixing some old outdated scripts - UV and the Earthquake script  (Read 5201 times)

0 Members and 1 Guest are viewing this topic.

Offline AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Well it been a while since I posted anything on here. But I could use a little help updated a few stand alone scripts including the uv forecast.

I download the latest get-uv-forecast.php

Code: [Select]
<?php
//import UV Forecast
// Script by Ken True - saratoga-weather.org
// Version 1.00 - 25-Feb-2008 - Initial Release
// Version 1.01 - 01-Mar-2008 - fixed logic to skip header row
// Version 1.02 - 03-Mar-2008 - added logic to adjust return arrays so [0] is always 'today's forecast
//                              based on timezone setting in $ourTZ (or $SITE['tz'] for templates
// Version 1.03 - 03-Jul-2009 - PHP5 support for timezone set
// Version 1.04 - 26-Jan-2011 - added support for $cacheFileDir for cache file
// Version 1.05 - 15-Feb-2011 - fixed undefined index Notice: errata
// Version 1.06 - 18-Feb-2011 - added support for comma decimal point in returned UVfcstUVI array
//
// error_reporting(E_ALL); // uncomment for error checking
// this script is designed to be used by
//   include("get-UV-forecast-inc.php");
//
// the script does no printing other than the HTML comments on status and the
// required copyright info.
//
//  to print values in your page, just:
//
//   echo "UV Forecast $UVfcstDate[0] is $UVfcstUVI[0]\n";
//
//  Returns Arrays:
//
//  $UVfcstDate[n]  -- date of forecast in dd Mon yyyy format
//  $UVfcstUVI[n]   -- forecast UVI in dd.d format
//                     n=0...8 (usually)
//  $UVfcstDOW[n]   -- forecast DayOfWeek ('Sunday' ... 'Saturday') from date('l',time());
//  $UVfcstISO[n]   -- forecast date in YYYYMMDD format.
//  will return $UVfcstUVI[n] = 'n/a' if forecast is not available.
// 
// -------------Settings ---------------------------------
  
$cacheFileDir './';      // default cache file directory
  
$myLat '33.6530';    //North=positive, South=negative decimal degrees
  
$myLong '-112.0278';  //East=positive, West=negative decimal degrees
  
$ourTZ "America/Phoenix";  //NOTE: this *MUST* be set correctly to
// translate UTC times to your LOCAL time for the displays.
//  http://us.php.net/manual/en/timezones.php  has the list of timezone names
//  pick the one that is closest to your location and put in $ourTZ like:
//   $ourTZ = "Europe/Paris";  
//   $ourTZ = "Pacific/Auckland";
  
$commaDecimal false;     // =true to use comma as decimal point in UVfcstUVI
// -------------End Settings -----------------------------
//
$UVversion 'get-UV-forecast-inc.php V1.06 - 18-Feb-2011';
// the following note is required by agreement with the authors of the website www.temis.nl
/* -----------------------------------------------------------------------------------------
Date: Wed, 20 Feb 2008 11:30:43 +0100
From: Ronald van der A <avander@knmi.nl>
Organization: KNMI
To: webmaster@saratoga-weather.org
CC: Ronald.van.der.A@knmi.nl, Jos.van.Geffen@knmi.nl
Subject: Re: Request to use data

Dear Ken,

If you change the line into

<p>UV forecast courtesy of and <a href="http://www.temis.nl/">Copyright
&copy; KNMI/ESA</a>. Used with permission.</p>

then it is ok for us. In this way KNMI is acknowledged, who have done
the major part of the UV product development.

Best regards,
Ronald van der A
 ----------------------------------------------------------------------------------------- */
$requiredNote 'UV forecast courtesy of and Copyright &copy; KNMI/ESA (http://www.temis.nl/). Used with permission.';
//
// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['latitude']))  {$myLat $SITE['latitude'];}
if (isset(
$SITE['longitude']))  {$myLong $SITE['longitude'];}
if (isset(
$SITE['tz'])) {$ourTZ $SITE['tz']; }
if(isset(
$SITE['cacheFileDir']))     {$cacheFileDir $SITE['cacheFileDir']; }
if(isset(
$SITE['commaDecimal']))     {$commaDecimal $SITE['commaDecimal']; }
// end of overrides from Settings.php

$myLat round($myLat,4);
$myLong round($myLong,4);
//
$UV_URL "http://www.temis.nl/uvradiation/nrt/uvindex.php?lon=$myLong&lat=$myLat";
//
// create a 'uv-forecast.txt' file in the same directory as the script.
// you may have to set the permissions on the file to '666' so it is writable
// by the webserver.
$UVcacheName $cacheFileDir."uv-forecast.txt";
$UVrefetchSeconds 3600;
// ---------- end of settings -----------------------

if (isset($_REQUEST['sce']) && 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;
}

print 
"<!-- $UVversion -->\n<!-- $requiredNote -->\n";
// Establish timezone offset for time display
# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
putenv("TZ=" $ourTZ);
# $Status .= "<!-- using putenv(\"TZ=$ourTZ\") -->\n";
    
} else {
date_default_timezone_set("$ourTZ");
# $Status .= "<!-- using date_default_timezone_set(\"$ourTZ\") -->\n";
   
}
 
$TZ date('T',time()); // get our timezone abbr

// You can now force the cache to update by adding ?force=1 to the end of the URL

if ( empty($_REQUEST['force']) ) 
        
$_REQUEST['force']="0";

$Force $_REQUEST['force'];

if (
$Force==1) {
      
$html fetchUVUrlWithoutHanging($UV_URL,$UVcacheName); 
      print 
"<!-- force reload from URL $UV_URL -->\n";
      
$fp fopen($UVcacheName"w"); 
  if($fp) {
        
$write fputs($fp$html); 
        
fclose($fp);
  } else {
    print "<!--Unable to write cache $UVcacheName -->\n";
  }



// refresh cached copy of page if needed
// fetch/cache code by Tom at carterlake.org

if (file_exists($UVcacheName) and filemtime($UVcacheName) + $UVrefetchSeconds time()) {
      
$WhereLoaded "from cache $UVcacheName";
      
$html implode(''file($UVcacheName));
    } else {
      
$WhereLoaded "from URL $UV_URL";
      
$html fetchUVUrlWithoutHanging($UV_URL);
      
$fp fopen($UVcacheName"w"); 
  if($fp) {
        
$write fputs($fp$html); 
        
fclose($fp);
  } else {
    print "<!--Unable to write cache $UVcacheName -->\n";
  }
}
print 
"<!-- UV data load from $WhereLoaded -->\n";

/*$UVfcstDate = array_fill(0,9,'');   // initialize the return arrays
$UVfcstUVI  = array_fill(0,9,'n/a');
$UVfcstDOW  = array_fill(0,9,'');
$UVfcstYMD  = array_fill(0,9,'');
$UVfcstISO  = array_fill(0,9,'');
*/
$UVfcstDate = array();   // initialize the return arrays
$UVfcstUVI  = array();
$UVfcstDOW  = array();
$UVfcstYMD  = array();
$UVfcstISO  = array();

if(
strlen($html) < 50 ) {
  print 
"<!-- data not available -->\n";
  return;
}
// now slice it up
// Get the table to use:
  
preg_match_all('|<dl><dd>\s*<table(.*?)</table>|is',$html,$betweenspan);
//  print "<!-- betweenspan \n" . print_r($betweenspan[1],true) . " -->\n";

// slice the table into rows
  
preg_match_all('|<tr>(.*)</tr>|Uis',$betweenspan[1][0],$uvsets);
  
$uvsets $uvsets[1];
//  print "<!-- uvsets \n" . print_r($uvsets,true) . " -->\n";
/*
<!-- uvsets 
Array
(
    [0] => <td align=left ><i>&nbsp;<br>&nbsp; Date</i> </td>
    <td align=right><i>UV <br>&nbsp; index</i> </td>
    <td align=right><i>ozone <br>column</i> </td>
    [1] => <td align=right nowrap>&nbsp; 25 Feb 2008 </td>
    <td align=right nowrap> 4.2 </td>
    <td align=right nowrap>&nbsp;  303.4 DU </td>

    [2] => <td align=right nowrap>&nbsp; 26 Feb 2008 </td>
    <td align=right nowrap> 4.5 </td>
    <td align=right nowrap>&nbsp;  291.8 DU </td>

    [3] => <td align=right nowrap>&nbsp; 27 Feb 2008 </td>
    <td align=right nowrap> 4.0 </td>
    <td align=right nowrap>&nbsp;  328.0 DU </td>
...
*/  
// $headings = array_shift($uvsets);  // lose the headings row

$indx 0;
foreach (
$uvsets as $n => $uvtext) { // take each row forecast and slice it up

// extract the data from the current table row
   
$uvtext preg_replace('|&nbsp;|is','',$uvtext);
   
preg_match_all('|<td.*?>
(.*?)</td>|is',$uvtext,$matches);
   
//   print "<!-- $indx : matches \n" . print_r($matches,true) . " -->\n";
   if (is_numeric(trim($matches[1][1]))) {
     $UVfcstDate[$indx] = trim($matches[1][0]);  // save the values found
$UVfcstUVI[$indx] = trim($matches[1][1]);   // save UV index
$t = strtotime($UVfcstDate[$indx]);
$UVfcstDOW[$indx] = date('l',$t); // sets to 'Sunday' thru 'Saturday'
$UVfcstYMD[$indx] = date('Ymd',$t);  // sets to YYYYMMDD
$indx++;
   }

}

foreach ($UVfcstDate as $i => $val) {
  print "<!-- Date='$val', UV='" . $UVfcstUVI[$i] . "' DOW='".$UVfcstDOW[$i]. "' YMD='".$UVfcstYMD[$i]."' -->\n";
}
// now fix up the array so 'today' is the [0] entry
$YMD = date('Ymd',time());
$shifted = 0;
foreach ($UVfcstYMD as $i => $uvYMD ) {
  if ($uvYMD < $YMD) {
    $junk = array_shift($UVfcstDate);
$junk = array_shift($UVfcstUVI);
$junk = array_shift($UVfcstDOW);
    $shifted++;
  }
}
for ($i=0;$i<$shifted;$i++) { // clean up the YMD array after shifting
  $junk = array_shift($UVfcstYMD);
}
if ($shifted) {
  print "<!-- after date=$YMD processing, shifted $shifted entries -->\n";
  foreach ($UVfcstDate as $i => $val) {
    print "<!-- Date='$val', UV='" . $UVfcstUVI[$i] . "' DOW='".$UVfcstDOW[$i]. "' YMD='".$UVfcstYMD[$i]."' -->\n";
  }
}

if($commaDecimal) {
foreach ($UVfcstUVI as $i => $uvi) {
$UVfcstUVI[$i] = preg_replace('|\.|',',',$UVfcstUVI[$i]);
}
   print "<!-- UVfcstUVI entries now use decimal comma format -->\n";
}

return; // printing is left to the including page

// ----------------------------functions -----------------------------------
 
 function fetchUVUrlWithoutHanging($url) // thanks to Tom at Carterlake.org for this script fragment
   {
   // Set maximum number of seconds (can have floating-point) to wait for feed before displaying page without feed
   $numberOfSeconds=4;   

   // Suppress error reporting so Web site visitors are unaware if the feed fails
   error_reporting(0);

   // Extract resource path and domain from URL ready for fsockopen

   $url = str_replace("http://","",$url);
   $urlComponents = explode("/",$url);
   $domain = $urlComponents[0];
   $resourcePath = str_replace($domain,"",$url);

   // Establish a connection
   $socketConnection = fsockopen($domain, 80, $errno, $errstr, $numberOfSeconds);

   if (!$socketConnection)
       {
       // You may wish to remove the following debugging line on a live Web site
        print("<!-- Network error: $errstr ($errno) -->\n");
       }    // end if
   else    {
       $xml = '';
       fputs($socketConnection, "GET $resourcePath HTTP/1.0\r\nHost: $domain\r\n\r\n");
   
       // Loop until end of file
       while (!feof($socketConnection))
           {
           $xml .= fgets($socketConnection, 4096);
           }    // end while

       fclose ($socketConnection);

       }    // end else
 

   return($xml);

   }    // end function
   
// ----------------------------------------------------------
     
?>

I need help in getting the result displayed
 here:http://www.pepperridgenorthvalley.com/uv-page.php

 :oops: that I left this so out of date

Jeanette
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #1 on: April 15, 2015, 10:16:52 PM »
Hi Jeanette,

Glad to hear from you again :)

The script is not very out-of-date .. Version 1.07 - 30-Mar-2011 is current, download from here

Your page is showing
Quote
<!-- get-UV-forecast-inc.php V1.06 - 18-Feb-2011 -->
<!-- UV forecast courtesy of and Copyright &copy; KNMI/ESA (http://www.temis.nl/). Used with permission. -->
<!-- UV data load from from URL http://www.temis.nl/uvradiation/nrt/uvindex.php?lon=-112.0278&lat=33.653 -->
<!-- Date='16 Apr 2015', UV='6.9' DOW='Thursday' YMD='20150416' -->
<!-- Date='17 Apr 2015', UV='7.7' DOW='Friday' YMD='20150417' -->
<!-- Date='18 Apr 2015', UV='8.5' DOW='Saturday' YMD='20150418' -->
<!-- Date='19 Apr 2015', UV='7.4' DOW='Sunday' YMD='20150419' -->
<!-- Date='20 Apr 2015', UV='7.1' DOW='Monday' YMD='20150420' -->
<!-- Date='20 Apr 2015', UV='7.5' DOW='Monday' YMD='20150420' -->
so even the older script is still working.

What is the specific issue you're having with the page?

Best regards,
Ken

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 AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #2 on: April 15, 2015, 10:53:22 PM »
Ken,

Thank you for the welcome back  :-)  The issue I have is  displaying the output on my page
http://www.pepperridgenorthvalley.com/uv-page.php with the icons like on your uv page http://saratoga-weather.org/uv-index.php on your site.  My page still says forecast unavailable.  I glad the updated get-uv-forecast.php  is working again I had an older version that got the forecast by city that was the old script I was refering to

It call the old version this way
Code: [Select]
<h1 id="pageName">UV Index Information Page - Be SunWise </h1>
  <div class="story">
<?php include("get-UV-forecast.php");  // grab the forecast from NOAA ?>

and then
Code: [Select]
<table>
<tr align="center">
  <th colspan="2"><br/>NOAA/EPA UV index Forecast for<br /> <?php echo $ourCity?></th>
</tr>
<tr align="center">
  <td><?php if (isset($UVIndex[1])) {echo $UVDate[1];} ?></td>
  <td><?php if (isset($UVIndex[2])) {echo $UVDate[2];} ?></td>
</tr>
<tr align="center">
  <td><?php if (isset($UVIndex[1])) {print GenIconUV($UVIcon[1]); }?></td>
  <td><?php if (isset($UVIndex[2])) {print GenIconUV($UVIcon[2]); }?></td>
</tr>
<tr align="center">
  <td><?php if (isset($UVIndex[1])) {print get_UVrange_code($UVIndex[1]); } else { print "Not Available"; }?></td>
  <td><?php if (isset($UVIndex[2])) {print get_UVrange_code($UVIndex[2]); } else { print "Not Available"; }?></td>
</tr>
</table>

Jeanette
« Last Edit: April 15, 2015, 11:16:24 PM by AZmonsooncats »
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #3 on: April 16, 2015, 12:12:35 AM »
Ahh... I remember that script.  Unfortunately the NOAA/EPA site no longer produces the data source.

The get-UV-forecast-inc.php script just gets the data from Temis.nl for your site, then you can use this code from my http://saratoga-weather.org/uv-index.php to display the icons
Code: [Select]
<?php
$ourTZ 
"America/Phoenix";  

$maxIcons 7;  // maximum number of icons to display

// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['tz']))  {$ourTZ $SITE['tz'];}
// end of overrides from Settings.php if available 
if (! isset($UVfcstDate[0])) { // load up the UV forecast script
  
$UVfcstDate array_fill(0,9,'');   // initialize the return arrays
  
$UVfcstUVI  array_fill(0,9,'n/a');
}
  include_once(
"get-UV-forecast-inc.php");
  
  
$maxIcons min($maxIcons,count($UVfcstUVI));  // use lesser of number of icons available

# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
  if (! ini_get('safe_mode') ) {
 putenv("TZ=$ourTZ");  // set our timezone for 'as of' date on file
  }  
    } else {
date_default_timezone_set("$ourTZ");
   }

?>
then where you want to display it on the page
Code: [Select]
<table>
<tr align="center">
  <th colspan="4"><br/>UV index Forecast</th>
</tr>
<tr align="center">
  <td><?php echo date('D',strtotime($UVfcstDate[0])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[1])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[2])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[3])); ?></td>
</tr>
<tr align="center">
  <td><?php echo gen_uv_icon($UVfcstUVI[0]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[1]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[2]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[3]); ?></td>
</tr>
<tr align="center">
  <td><?php echo $UVfcstUVI[0]; ?></td>
  <td><?php echo $UVfcstUVI[1]; ?></td>
  <td><?php echo $UVfcstUVI[2]; ?></td>
  <td><?php echo $UVfcstUVI[3]; ?></td>
</tr>
<tr align="center">
  <td><?php echo get_uv_word(round($UVfcstUVI[0],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[1],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[2],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[3],0)); ?></td>
</tr>
<tr>
  <td colspan="4" style="text-align: center;"><small><?php print $requiredNote?></small></td>
</tr>
</table>
and include near the end of the page
Code: [Select]
<?php 
if(!function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }
}


function 
gen_uv_icon($uv) {
global $SITE;
if($uv == 'n/a') { return( ''); }
$ourUVrounded round($uv,0);
if ($ourUVrounded 11) {$ourUVrounded 11; }
if ($ourUVrounded ) {$ourUVrounded 1; }
$ourUVicon "uv" sprintf("%02d",$ourUVrounded) . ".gif";

return( '<img src="'.$SITE['imagesDir']. $ourUVicon 
  '" height="76" width="40"  alt="UV Index" title="UV Index" />');
}
//=========================================================================
//  decode UV to word+color for display

function get_uv_word $uv ) {
global $SITE;
// figure out a text value and color for UV exposure text
//  0 to 2  Low
//  3 to 5     Moderate
//  6 to 7     High
//  8 to 10 Very High
//  11+     Extreme
   
switch (TRUE) {
 case ($uv == 'n/a'):
   $uv '';
 break;
     case (
$uv == 0):
       
$uv langtransstr('None');
     break;
     case ((
$uv 0) and ($uv 3)):
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;'.langtransstr('Low').'&nbsp;</span>';
     break;
     case ((
$uv >= 3) and ($uv 6)):
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;'.langtransstr('Medium').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 8)):
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;'.langtransstr('High').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 11)):
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;'.langtransstr('Very&nbsp;High').'&nbsp;</span>';
     break;
     case ((
$uv >= 11) ):
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;'.langtransstr('Extreme').'&nbsp;</span>';
     break;
   } 
// end switch
   
return $uv;
// end getUVword

?>

Hope this helps...

Best regards,
Ken
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 AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #4 on: April 16, 2015, 01:33:26 AM »
Hi Ken I tried inserting the code you post but it still has issues so I including the entire code on uv-index.php page

Code: [Select]
<?php 
//------------------------------------------------

  
   
include("./wdlive/testtags2.php"); 
?>

<?php
$ourTZ 
"America/Phoenix";  

$maxIcons 7;  // maximum number of icons to display

// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['tz']))  {$ourTZ $SITE['tz'];}
// end of overrides from Settings.php if available 
if (! isset($UVfcstDate[0])) { // load up the UV forecast script
  
$UVfcstDate array_fill(0,9,'');   // initialize the return arrays
  
$UVfcstUVI  array_fill(0,9,'n/a');
}
  include_once(
"get-UV-forecast.php");
  
  
$maxIcons min($maxIcons,count($UVfcstUVI));  // use lesser of number of icons available

# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
  if (! ini_get('safe_mode') ) {
 putenv("TZ=$ourTZ");  // set our timezone for 'as of' date on file
  }  
    } else {
date_default_timezone_set("$ourTZ");
   }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- site specific <head></head><body> stuff here -->
<head>
<title>Pepper Ridge North Valley, Phoenix, Az - UV Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Refresh" content="300" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
 <h1 id="pageName">UV Index Information Page - Be SunWise </h1>
  <div class="story">

<table width="100%">
<tr>
<td align="center" valign="middle"><table cellpadding="3" cellspacing="1" style="border: solid 2px #0066FF; font: bold 10pt Arial, Helvetica, sans-serif;
color:#800080;" bgcolor="#EEE8AA">
  <tr align="left">
    <td class="indxData10"><b>Current UV Index:</b></td>
    <td align="left"  class="indxData10"><?php echo $VPuv?> @&nbsp;<?php echo date('g:ia' strtotime($time)); ?> </td>
    <td><? echo get_UVrange_code( $VPuv ); ?></td>
  </tr>
  <?php 
if ($burntime <> '---') { 
print 
"<tr align=\"left\"><td>Estimated time to sunburn<sup>1</sup></td><td>$burntime minutes</td><td>&nbsp;</td></tr>\n"


?>

  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Today's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuv?> @&nbsp;<?php echo date('g:ia' strtotime($highuvtime)); ?> </td>
    <td><? echo get_UVrange_code( $highuv ); ?></td>
  </tr>
  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Yesterday's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuvyest?> @&nbsp;<?php echo date('g:ia' strtotime($highuvyesttime)); ?> </td>
    <td><? echo get_UVrange_code( $highuvyest ); ?></td>
  </tr>
 
</table>

  <table>
<tr align="center">
  <th colspan="4"><br/>UV index Forecast</th>
</tr>
<tr align="center">
  <td><?php echo date('D',strtotime($UVfcstDate[0])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[1])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[2])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[3])); ?></td>
</tr>
<tr align="center">
  <td><?php echo gen_uv_icon($UVfcstUVI[0]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[1]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[2]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[3]); ?></td>
</tr>
<tr align="center">
  <td><?php echo $UVfcstUVI[0]; ?></td>
  <td><?php echo $UVfcstUVI[1]; ?></td>
  <td><?php echo $UVfcstUVI[2]; ?></td>
  <td><?php echo $UVfcstUVI[3]; ?></td>
</tr>
<tr align="center">
  <td><?php echo get_uv_word(round($UVfcstUVI[0],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[1],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[2],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[3],0)); ?></td>
</tr>
<tr>
  <td colspan="4" style="text-align: center;"><small><?php print $requiredNote?></small></td>
</tr>
</table>
</td>
<td align="right" valign="top">
<img src="./Photos/uv_image.jpg" alt="UV Index Scale" title="UV Index Scale" width="330" height="277"
/>
</td>
</tr>
<?php 
if ($burntime <> '---') { 
print 
"<tr><td colspan=\"2\"><small><sup>1</sup>Estimated time in minutes to sunburn normal skin at the current UV rate.</small></td></tr>\n"


?>


</table>


  <table width="100%"  style="border: none; " cellpadding="0" cellspacing="2" >
  <tr>
    <th>UV index Forecast</th>
    <th>UV index Last 5 days and forecast</th>
  </tr>
  <tr>
    <td>
      <div align="center"><img src="http://icons.wunderground.com/data/images/sw_uv.gif" align="center" alt="UV forecast map"
title="UV Forecast" width="320" height="240" /></div></td>
    <td><div align="center"><img src="http://icons.wunderground.com/data/640x480/sw_uv_anim.gif" align="center" alt="UV Forecast Animation"
   title="UV Forecast Animation" width="320" height="240" /></div></td>
  </tr>
</table>
   <table width="100%" border="0">
     <tr>
       <td align="center">
   </td></tr></table>
   <table width="100%" border="0">
     <tr><th align="center">Solar Radiation - last 72 hours</th><th align="center">UV index - last 72 hours</th></tr>
     <tr>
<td align="center"><img src="./data2/SolarRadHistory.gif" alt="Graph of last 72 hours Solar Radiation" title="Graph of last 72 hours Solar Radiation" width="320" height="200" /></td>
 
       <td align="center"><img src="./data2/UVHistory.gif" alt="Graph of last 72 hours UV Index" title="Graph of last 72 hours UV Index" width="320" height="200" /></td>
     </tr>
   </table>


  </div>
  <div class="story" align="left" cellpadding="5px" style="margin-left: 25px;">
  <h2>What is the UV Index?</h2>
         <p>Some exposure to sunlight can be enjoyable; however, too much could be dangerous. Overexposure to the sun's ultraviolet (UV) radiation can cause immediate effects such as sunburn and long-term problems such as skin cancer and cataracts. The UV Index, which was developed by the National Weather Service and the U.S. Environmental Protection Agency (EPA), provides important information to help you plan your outdoor activities to prevent overexposure to the sun's rays. </p>
         <p>The UV Index provides an indicator of the expected risk of overexposure to the sun. The Index measures UV intensity levels on a scale of 1 to 11+, where low indicates a minimal risk of overexposure and 11+ means an extreme risk. The UV Index takes into account clouds and other local conditions that affect the amount of UV radiation reaching the ground. </p>
         <p>By taking a few simple precautions, you can greatly reduce your risk of sun-related illnesses. To <a href="http://www.epa.gov/sunwise/index.html"target="_blank">Be SunWise</a>, consider the following steps: </p>
         <ul>
           <li>Limit your time in the sun between 10 a.m. and 4 p.m. <br />
           </li>
           <li>Whenever possible, seek shade. <br />
           </li>
           <li>Use a broad spectrum sunscreen with an SPF of at least 15. <br />
           </li>
           <li>Wear a wide-brimmed hat and if possible, tightly woven, full-length clothing. <br />
           </li>
           <li>Wear UV-protective sunglasses. <br />
           </li>
           <li>Watch the daily UV Index. <br />
           </li>
         </ul>
         <p>While you should always take precautions against overexposure to the sun, please take special care to adopt the safeguards when the UV Index indicates levels of moderate or above. </p>
   <p>&nbsp;</p>
   <p>Sources of data:<br />
   UV Index forecast from <a href="http://www.weather.gov/view/national.php?prodtype=ultraviolet">NOAA/EPA</a><br />
UV Index maps from <a href="http://www.wunderground.com/US/Region/SW/UVForecast.html">WeatherUnderground</a><br />
   Actual UV index readings/graph data from UV sensor on Davis Vantage Pro Plus weather station</p>
   <p>Thanks to Ken at <a href="http://www.capitolaweather.net/">CapitolaWeather.net</a> for the text and inspiration for this page.</p>

  </div>
</div>
<!--end content -->
<?php 

function get_UVrange_code $uv ) { 
  
// figure out a text value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv 'None'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;Low&nbsp;</span>'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;Medium&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;Very&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv 11) ): 
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;Extreme&nbsp;</span>'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_range 

function get_UVcolor $uv ) { 
  
// figure out a color value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv '#FFFFFF'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '#A4CE6a'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '#FBEE09'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '#FD9125'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '#F63F37'
     break; 
     case ((
$uv 11) ): 
       
$uv '#807780'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_color 

//function get_UVicon ( $uv ) { 
  // figure out an icon for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
//   switch (TRUE) { 
//     case ($uv == 0 or floor($uv) == 0): 
//       $uv = 'src="./UV-images/UV.gif" height="93" width="80" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//     case (($uv >= 1) and ($uv < 11)): 
//       $uv = floor($uv); 
//      $uv = 'src="./UV-images/UV' . sprintf('%02d',$uv) .  '.gif" height="76" width="40" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//     case ($uv >= 11): 
//      $uv = 'src="./UV-images/UV11.gif" height="76" width="40" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//   } // end switch 
//   return $uv; 
//} // end get_uv_color 

//function GenIconUV($icon) { 
 // if ($icon <> '') { 
  
//    return("<img $icon width=\"40\" height=\"76\" alt=\"UV Index forecast\" />"); 
//  } else { 
//    return("Zero"); 
//  } 
//} 

?>

<?php 
if(!function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }
}


function 
gen_uv_icon($uv) {
global $SITE;
if($uv == 'n/a') { return( ''); }
$ourUVrounded round($uv,0);
if ($ourUVrounded 11) {$ourUVrounded 11; }
if ($ourUVrounded ) {$ourUVrounded 1; }
$ourUVicon "uv" sprintf("%02d",$ourUVrounded) . ".gif";

return( '<img src="./UV-images/'.$SITE['imagesDir']. $ourUVicon 
  '" height="76" width="40"  alt="UV Index" title="UV Index" />');
}
//=========================================================================
//  decode UV to word+color for display

function get_uv_word $uv ) {
global $SITE;
// figure out a text value and color for UV exposure text
//  0 to 2  Low
//  3 to 5     Moderate
//  6 to 7     High
//  8 to 10 Very High
//  11+     Extreme
   
switch (TRUE) {
 case ($uv == 'n/a'):
   $uv '';
 break;
     case (
$uv == 0):
       
$uv langtransstr('None');
     break;
     case ((
$uv 0) and ($uv 3)):
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;'.langtransstr('Low').'&nbsp;</span>';
     break;
     case ((
$uv >= 3) and ($uv 6)):
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;'.langtransstr('Medium').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 8)):
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;'.langtransstr('High').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 11)):
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;'.langtransstr('Very&nbsp;High').'&nbsp;</span>';
     break;
     case ((
$uv >= 11) ):
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;'.langtransstr('Extreme').'&nbsp;</span>';
     break;
   } 
// end switch
   
return $uv;
// end getUVword

?>

<!-- site specific footer, </body></html> -->
</body>
</html>


When it works it cuts everything that is displayed after the forecast and icon liinks are missing this is a stand alone page not sure where the error is thank you for the help still got to figure this out  #-o

Jeanette
« Last Edit: April 18, 2015, 07:24:31 PM by AZmonsooncats »
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #5 on: April 18, 2015, 07:27:10 PM »
UPDATE:
Think something is still missing  When using the code in previous post This is what the page outputs
http://www.pepperridgenorthvalley.com/uv-index2.php It stops short of displaying the UV word and the images are not displayed.  #-o

Any additional help would be appreciated

Thanks
Jeanette
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #6 on: April 20, 2015, 12:01:33 PM »
Please post the contents of the uv-index2.php page.  It looks like a fatal error (perhaps a duplicate definition of a function) is causing the page to stop rendering.
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 AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #7 on: April 20, 2015, 02:17:12 PM »
Ken Here is the code again for the page specific contents of the UV-index2.page. The uv-index icons are located in UV-images directory on my website.


Code: [Select]
<?php 
//------------------------------------------------

  
   
include("./wdlive/testtags2.php"); 
?>

<?php
$ourTZ 
"America/Phoenix";  

$maxIcons 7;  // maximum number of icons to display

// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['tz']))  {$ourTZ $SITE['tz'];}
// end of overrides from Settings.php if available 
if (! isset($UVfcstDate[0])) { // load up the UV forecast script
  
$UVfcstDate array_fill(0,9,'');   // initialize the return arrays
  
$UVfcstUVI  array_fill(0,9,'n/a');
}
  include_once(
"get-UV-forecast.php");
  
  
$maxIcons min($maxIcons,count($UVfcstUVI));  // use lesser of number of icons available

# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
  if (! ini_get('safe_mode') ) {
 putenv("TZ=$ourTZ");  // set our timezone for 'as of' date on file
  }  
    } else {
date_default_timezone_set("$ourTZ");
   }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- site specific <head></head><body> stuff here -->
<head>
<title>Pepper Ridge North Valley, Phoenix, Az - UV Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Refresh" content="300" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
 <h1 id="pageName">UV Index Information Page - Be SunWise </h1>
  <div class="story">

<table width="100%">
<tr>
<td align="center" valign="middle"><table cellpadding="3" cellspacing="1" style="border: solid 2px #0066FF; font: bold 10pt Arial, Helvetica, sans-serif;
color:#800080;" bgcolor="#EEE8AA">
  <tr align="left">
    <td class="indxData10"><b>Current UV Index:</b></td>
    <td align="left"  class="indxData10"><?php echo $VPuv?> @&nbsp;<?php echo date('g:ia' strtotime($time)); ?> </td>
    <td><? echo get_UVrange_code( $VPuv ); ?></td>
  </tr>
  <?php 
if ($burntime <> '---') { 
print 
"<tr align=\"left\"><td>Estimated time to sunburn<sup>1</sup></td><td>$burntime minutes</td><td>&nbsp;</td></tr>\n"


?>

  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Today's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuv?> @&nbsp;<?php echo date('g:ia' strtotime($highuvtime)); ?> </td>
    <td><? echo get_UVrange_code( $highuv ); ?></td>
  </tr>
  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Yesterday's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuvyest?> @&nbsp;<?php echo date('g:ia' strtotime($highuvyesttime)); ?> </td>
    <td><? echo get_UVrange_code( $highuvyest ); ?></td>
  </tr>
 
</table>

  <table>
<tr align="center">
  <th colspan="4"><br/>UV index Forecast</th>
</tr>
<tr align="center">
  <td><?php echo date('D',strtotime($UVfcstDate[0])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[1])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[2])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[3])); ?></td>
</tr>
<tr align="center">
  <td><?php echo gen_uv_icon($UVfcstUVI[0]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[1]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[2]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[3]); ?></td>
</tr>
<tr align="center">
  <td><?php echo $UVfcstUVI[0]; ?></td>
  <td><?php echo $UVfcstUVI[1]; ?></td>
  <td><?php echo $UVfcstUVI[2]; ?></td>
  <td><?php echo $UVfcstUVI[3]; ?></td>
</tr>
<tr align="center">
  <td><?php echo get_uv_word(round($UVfcstUVI[0],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[1],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[2],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[3],0)); ?></td>
</tr>
<tr>
  <td colspan="4" style="text-align: center;"><small><?php print $requiredNote?></small></td>
</tr>
</table>
</td>
<td align="right" valign="top">
<img src="./Photos/uv_image.jpg" alt="UV Index Scale" title="UV Index Scale" width="330" height="277"
/>
</td>
</tr>
<?php 
if ($burntime <> '---') { 
print 
"<tr><td colspan=\"2\"><small><sup>1</sup>Estimated time in minutes to sunburn normal skin at the current UV rate.</small></td></tr>\n"


?>


</table>


  <table width="100%"  style="border: none; " cellpadding="0" cellspacing="2" >
  <tr>
    <th>UV index Forecast</th>
    <th>UV index Last 5 days and forecast</th>
  </tr>
  <tr>
    <td>
      <div align="center"><img src="http://icons.wunderground.com/data/images/sw_uv.gif" align="center" alt="UV forecast map"
title="UV Forecast" width="320" height="240" /></div></td>
    <td><div align="center"><img src="http://icons.wunderground.com/data/640x480/sw_uv_anim.gif" align="center" alt="UV Forecast Animation"
   title="UV Forecast Animation" width="320" height="240" /></div></td>
  </tr>
</table>
   <table width="100%" border="0">
     <tr>
       <td align="center">
   </td></tr></table>
   <table width="100%" border="0">
     <tr><th align="center">Solar Radiation - last 72 hours</th><th align="center">UV index - last 72 hours</th></tr>
     <tr>
<td align="center"><img src="./data2/SolarRadHistory.gif" alt="Graph of last 72 hours Solar Radiation" title="Graph of last 72 hours Solar Radiation" width="320" height="200" /></td>
 
       <td align="center"><img src="./data2/UVHistory.gif" alt="Graph of last 72 hours UV Index" title="Graph of last 72 hours UV Index" width="320" height="200" /></td>
     </tr>
   </table>


  </div>
  <div class="story" align="left" cellpadding="5px" style="margin-left: 25px;">
  <h2>What is the UV Index?</h2>
         <p>Some exposure to sunlight can be enjoyable; however, too much could be dangerous. Overexposure to the sun's ultraviolet (UV) radiation can cause immediate effects such as sunburn and long-term problems such as skin cancer and cataracts. The UV Index, which was developed by the National Weather Service and the U.S. Environmental Protection Agency (EPA), provides important information to help you plan your outdoor activities to prevent overexposure to the sun's rays. </p>
         <p>The UV Index provides an indicator of the expected risk of overexposure to the sun. The Index measures UV intensity levels on a scale of 1 to 11+, where low indicates a minimal risk of overexposure and 11+ means an extreme risk. The UV Index takes into account clouds and other local conditions that affect the amount of UV radiation reaching the ground. </p>
         <p>By taking a few simple precautions, you can greatly reduce your risk of sun-related illnesses. To <a href="http://www.epa.gov/sunwise/index.html"target="_blank">Be SunWise</a>, consider the following steps: </p>
         <ul>
           <li>Limit your time in the sun between 10 a.m. and 4 p.m. <br />
           </li>
           <li>Whenever possible, seek shade. <br />
           </li>
           <li>Use a broad spectrum sunscreen with an SPF of at least 15. <br />
           </li>
           <li>Wear a wide-brimmed hat and if possible, tightly woven, full-length clothing. <br />
           </li>
           <li>Wear UV-protective sunglasses. <br />
           </li>
           <li>Watch the daily UV Index. <br />
           </li>
         </ul>
         <p>While you should always take precautions against overexposure to the sun, please take special care to adopt the safeguards when the UV Index indicates levels of moderate or above. </p>
   <p>&nbsp;</p>
   <p>Sources of data:<br />
   UV Index forecast from <a href="http://www.weather.gov/view/national.php?prodtype=ultraviolet">NOAA/EPA</a><br />
UV Index maps from <a href="http://www.wunderground.com/US/Region/SW/UVForecast.html">WeatherUnderground</a><br />
   Actual UV index readings/graph data from UV sensor on Davis Vantage Pro Plus weather station</p>
   <p>Thanks to Ken at <a href="http://www.capitolaweather.net/">CapitolaWeather.net</a> for the text and inspiration for this page.</p>

  </div>
</div>
<!--end content -->
<?php 

function get_UVrange_code $uv ) { 
  
// figure out a text value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv 'None'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;Low&nbsp;</span>'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;Medium&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;Very&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv 11) ): 
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;Extreme&nbsp;</span>'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_range 

function get_UVcolor $uv ) { 
  
// figure out a color value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv '#FFFFFF'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '#A4CE6a'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '#FBEE09'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '#FD9125'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '#F63F37'
     break; 
     case ((
$uv 11) ): 
       
$uv '#807780'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_color 

//function get_UVicon ( $uv ) { 
  // figure out an icon for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
//   switch (TRUE) { 
//     case ($uv == 0 or floor($uv) == 0): 
//       $uv = 'src="./UV-images/UV.gif" height="93" width="80" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//     case (($uv >= 1) and ($uv < 11)): 
//       $uv = floor($uv); 
//      $uv = 'src="./UV-images/UV' . sprintf('%02d',$uv) .  '.gif" height="76" width="40" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//     case ($uv >= 11): 
//      $uv = 'src="./UV-images/UV11.gif" height="76" width="40" alt="Current UV Index" title="Current UV Index"'; 
//     break; 
//   } // end switch 
//   return $uv; 
//} // end get_uv_color 

//function GenIconUV($icon) { 
 // if ($icon <> '') { 
  
//    return("<img $icon width=\"40\" height=\"76\" alt=\"UV Index forecast\" />"); 
//  } else { 
//    return("Zero"); 
//  } 
//} 

?>

<?php 
if(!function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }
}


function 
gen_uv_icon($uv) {
global $SITE;
if($uv == 'n/a') { return( ''); }
$ourUVrounded round($uv,0);
if ($ourUVrounded 11) {$ourUVrounded 11; }
if ($ourUVrounded ) {$ourUVrounded 1; }
$ourUVicon "uv" sprintf("%02d",$ourUVrounded) . ".gif";

return( '<img src="./UV-images/'.$SITE['imagesDir']. $ourUVicon 
  '" height="76" width="40"  alt="UV Index" title="UV Index" />');
}
//=========================================================================
//  decode UV to word+color for display

function get_uv_word $uv ) {
global $SITE;
// figure out a text value and color for UV exposure text
//  0 to 2  Low
//  3 to 5     Moderate
//  6 to 7     High
//  8 to 10 Very High
//  11+     Extreme
   
switch (TRUE) {
 case ($uv == 'n/a'):
   $uv '';
 break;
     case (
$uv == 0):
       
$uv langtransstr('None');
     break;
     case ((
$uv 0) and ($uv 3)):
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;'.langtransstr('Low').'&nbsp;</span>';
     break;
     case ((
$uv >= 3) and ($uv 6)):
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;'.langtransstr('Medium').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 8)):
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;'.langtransstr('High').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 11)):
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;'.langtransstr('Very&nbsp;High').'&nbsp;</span>';
     break;
     case ((
$uv >= 11) ):
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;'.langtransstr('Extreme').'&nbsp;</span>';
     break;
   } 
// end switch
   
return $uv;
// end getUVword

?>

<!-- site specific footer, </body></html> -->
</body>
</html>

Thanks for your response

Jeanette
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #8 on: April 20, 2015, 04:46:54 PM »
Hi Jeanette,

Your page was missing a couple of things.  The fatal error was caused by a misplaced (by me) function definition, and by your site not having a get-UV-forecast-inc.php and ./UVimages/ directory (in attached .zip).

Code: [Select]
<?php 
//------------------------------------------------

  
  
include("./wdlive/testtags2.php"); 
?>

<?php
$ourTZ 
"America/Phoenix";  

$maxIcons 7;  // maximum number of icons to display

// overrides from Settings.php if available
global $SITE;
if (isset(
$SITE['tz']))  {$ourTZ $SITE['tz'];}
// end of overrides from Settings.php if available 
if (! isset($UVfcstDate[0])) { // load up the UV forecast script
  
$UVfcstDate array_fill(0,9,'');   // initialize the return arrays
  
$UVfcstUVI  array_fill(0,9,'n/a');
}
  include_once(
"get-UV-forecast-inc.php");
  
  
$maxIcons min($maxIcons,count($UVfcstUVI));  // use lesser of number of icons available

# Set timezone in PHP5/PHP4 manner
  
if (!function_exists('date_default_timezone_set')) {
  if (! ini_get('safe_mode') ) {
 putenv("TZ=$ourTZ");  // set our timezone for 'as of' date on file
  }  
    } else {
date_default_timezone_set("$ourTZ");
   }
if(!
function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- site specific <head></head><body> stuff here -->
<head>
<title>Pepper Ridge North Valley, Phoenix, Az - UV Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Refresh" content="300" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
 <h1 id="pageName">UV Index Information Page - Be SunWise </h1>
  <div class="story">

<table width="100%">
<tr>
<td align="center" valign="middle"><table cellpadding="3" cellspacing="1" style="border: solid 2px #0066FF; font: bold 10pt Arial, Helvetica, sans-serif;
color:#800080;" bgcolor="#EEE8AA">
  <tr align="left">
    <td class="indxData10"><b>Current UV Index:</b></td>
    <td align="left"  class="indxData10"><?php echo $VPuv?> @&nbsp;<?php echo date('g:ia' strtotime($time)); ?> </td>
    <td><? echo get_UVrange_code( $VPuv ); ?></td>
  </tr>
  <?php 
if ($burntime <> '---') { 
print 
"<tr align=\"left\"><td>Estimated time to sunburn<sup>1</sup></td><td>$burntime minutes</td><td>&nbsp;</td></tr>\n"


?>

  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Today's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuv?> @&nbsp;<?php echo date('g:ia' strtotime($highuvtime)); ?> </td>
    <td><? echo get_UVrange_code( $highuv ); ?></td>
  </tr>
  <tr align="left" bgcolor="#EEE8AA">
    <td  class="indxData10">Yesterday's High:</td>
    <td align="left"  class="indxData10"><?php echo $highuvyest?> @&nbsp;<?php echo date('g:ia' strtotime($highuvyesttime)); ?> </td>
    <td><? echo get_UVrange_code( $highuvyest ); ?></td>
  </tr>
 
</table>

  <table>
<tr align="center">
  <th colspan="4"><br/>UV index Forecast</th>
</tr>
<tr align="center">
  <td><?php echo date('D',strtotime($UVfcstDate[0])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[1])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[2])); ?></td>
  <td><?php echo date('D',strtotime($UVfcstDate[3])); ?></td>
</tr>
<tr align="center">
  <td><?php echo gen_uv_icon($UVfcstUVI[0]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[1]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[2]); ?></td>
  <td><?php echo gen_uv_icon($UVfcstUVI[3]); ?></td>
</tr>
<tr align="center">
  <td><?php echo $UVfcstUVI[0]; ?></td>
  <td><?php echo $UVfcstUVI[1]; ?></td>
  <td><?php echo $UVfcstUVI[2]; ?></td>
  <td><?php echo $UVfcstUVI[3]; ?></td>
</tr>
<tr align="center">
  <td><?php echo get_uv_word(round($UVfcstUVI[0],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[1],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[2],0)); ?></td>
  <td><?php echo get_uv_word(round($UVfcstUVI[3],0)); ?></td>
</tr>
<tr>
  <td colspan="4" style="text-align: center;"><small><?php print $requiredNote?></small></td>
</tr>
</table>
</td>
<td align="right" valign="top">
<img src="./Photos/uv_image.jpg" alt="UV Index Scale" title="UV Index Scale" width="330" height="277"
/>
</td>
</tr>
<?php 
if ($burntime <> '---') { 
print 
"<tr><td colspan=\"2\"><small><sup>1</sup>Estimated time in minutes to sunburn normal skin at the current UV rate.</small></td></tr>\n"


?>


</table>


  <table width="100%"  style="border: none; " cellpadding="0" cellspacing="2" >
  <tr>
    <th>UV index Forecast</th>
    <th>UV index Last 5 days and forecast</th>
  </tr>
  <tr>
    <td>
      <div align="center"><img src="http://icons.wunderground.com/data/images/sw_uv.gif" align="center" alt="UV forecast map"
title="UV Forecast" width="320" height="240" /></div></td>
    <td><div align="center"><img src="http://icons.wunderground.com/data/640x480/sw_uv_anim.gif" align="center" alt="UV Forecast Animation"
   title="UV Forecast Animation" width="320" height="240" /></div></td>
  </tr>
</table>
   <table width="100%" border="0">
     <tr>
       <td align="center">
   </td></tr></table>
   <table width="100%" border="0">
     <tr><th align="center">Solar Radiation - last 72 hours</th><th align="center">UV index - last 72 hours</th></tr>
     <tr>
<td align="center"><img src="./data2/SolarRadHistory.gif" alt="Graph of last 72 hours Solar Radiation" title="Graph of last 72 hours Solar Radiation" width="320" height="200" /></td>
 
       <td align="center"><img src="./data2/UVHistory.gif" alt="Graph of last 72 hours UV Index" title="Graph of last 72 hours UV Index" width="320" height="200" /></td>
     </tr>
   </table>


  </div>
  <div class="story" align="left" cellpadding="5px" style="margin-left: 25px;">
  <h2>What is the UV Index?</h2>
         <p>Some exposure to sunlight can be enjoyable; however, too much could be dangerous. Overexposure to the sun's ultraviolet (UV) radiation can cause immediate effects such as sunburn and long-term problems such as skin cancer and cataracts. The UV Index, which was developed by the National Weather Service and the U.S. Environmental Protection Agency (EPA), provides important information to help you plan your outdoor activities to prevent overexposure to the sun's rays. </p>
         <p>The UV Index provides an indicator of the expected risk of overexposure to the sun. The Index measures UV intensity levels on a scale of 1 to 11+, where low indicates a minimal risk of overexposure and 11+ means an extreme risk. The UV Index takes into account clouds and other local conditions that affect the amount of UV radiation reaching the ground. </p>
         <p>By taking a few simple precautions, you can greatly reduce your risk of sun-related illnesses. To <a href="http://www.epa.gov/sunwise/index.html"target="_blank">Be SunWise</a>, consider the following steps: </p>
         <ul>
           <li>Limit your time in the sun between 10 a.m. and 4 p.m. <br />
           </li>
           <li>Whenever possible, seek shade. <br />
           </li>
           <li>Use a broad spectrum sunscreen with an SPF of at least 15. <br />
           </li>
           <li>Wear a wide-brimmed hat and if possible, tightly woven, full-length clothing. <br />
           </li>
           <li>Wear UV-protective sunglasses. <br />
           </li>
           <li>Watch the daily UV Index. <br />
           </li>
         </ul>
         <p>While you should always take precautions against overexposure to the sun, please take special care to adopt the safeguards when the UV Index indicates levels of moderate or above. </p>
   <p>&nbsp;</p>
   <p>Sources of data:<br />
   UV Index forecast from <a href="http://www.weather.gov/view/national.php?prodtype=ultraviolet">NOAA/EPA</a><br />
UV Index maps from <a href="http://www.wunderground.com/US/Region/SW/UVForecast.html">WeatherUnderground</a><br />
   Actual UV index readings/graph data from UV sensor on Davis Vantage Pro Plus weather station</p>
   <p>Thanks to Ken at <a href="http://www.capitolaweather.net/">CapitolaWeather.net</a> for the text and inspiration for this page.</p>

  </div>
</div>
<!--end content -->
<?php 

function get_UVrange_code $uv ) { 
  
// figure out a text value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv 'None'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;Low&nbsp;</span>'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;Medium&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;Very&nbsp;High&nbsp;</span>'
     break; 
     case ((
$uv 11) ): 
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;Extreme&nbsp;</span>'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_range 

function get_UVcolor $uv ) { 
  
// figure out a color value for UV exposure 
//  0 to 2  Low 
//  3 to 5    Moderate 
//  6 to 7    High 
//  8 to 10 Very High 
//  11+    Extreme 
   
switch (TRUE) { 
     case (
$uv == 0): 
       
$uv '#FFFFFF'
     break; 
     case ((
$uv 0) and ($uv 3)): 
       
$uv '#A4CE6a'
     break; 
     case ((
$uv >= 3) and ($uv 6)): 
       
$uv '#FBEE09'
     break; 
     case ((
$uv >=) and ($uv 8)): 
       
$uv '#FD9125'
     break; 
     case ((
$uv >=) and ($uv 11)): 
       
$uv '#F63F37'
     break; 
     case ((
$uv 11) ): 
       
$uv '#807780'
     break; 
   } 
// end switch 
   
return $uv
// end get_uv_color 


?>

<?php 


function gen_uv_icon($uv) {
global $SITE;
if($uv == 'n/a') { return( ''); }
$ourUVrounded round($uv,0);
if ($ourUVrounded 11) {$ourUVrounded 11; }
if ($ourUVrounded ) {$ourUVrounded 1; }
$ourUVicon "uv" sprintf("%02d",$ourUVrounded) . ".gif";

return( '<img src="./UV-images/'.$SITE['imagesDir']. $ourUVicon 
  '" height="76" width="40"  alt="UV Index" title="UV Index" />');
}
//=========================================================================
//  decode UV to word+color for display

function get_uv_word $uv ) {
global $SITE;
// figure out a text value and color for UV exposure text
//  0 to 2  Low
//  3 to 5     Moderate
//  6 to 7     High
//  8 to 10 Very High
//  11+     Extreme
   
switch (TRUE) {
 case ($uv == 'n/a'):
   $uv '';
 break;
     case (
$uv == 0):
       
$uv langtransstr('None');
     break;
     case ((
$uv 0) and ($uv 3)):
       
$uv '<span style="border: solid 1px; background-color: #A4CE6a;">&nbsp;'.langtransstr('Low').'&nbsp;</span>';
     break;
     case ((
$uv >= 3) and ($uv 6)):
       
$uv '<span style="border: solid 1px;background-color: #FBEE09;">&nbsp;'.langtransstr('Medium').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 8)):
       
$uv '<span style="border: solid 1px; background-color: #FD9125;">&nbsp;'.langtransstr('High').'&nbsp;</span>';
     break;
     case ((
$uv >=) and ($uv 11)):
       
$uv '<span style="border: solid 1px; color: #FFFFFF; background-color: #F63F37;">&nbsp;'.langtransstr('Very&nbsp;High').'&nbsp;</span>';
     break;
     case ((
$uv >= 11) ):
       
$uv '<span style="border: solid 1px; color: #FFFF00; background-color: #807780;">&nbsp;'.langtransstr('Extreme').'&nbsp;</span>';
     break;
   } 
// end switch
   
return $uv;
// end getUVword

?>

<!-- site specific footer, </body></html> -->
</body>
</html>

Best regards,
Ken
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 AZmonsooncats

  • Current weather conditions in North Phoenix, Ariz
  • Senior Contributor
  • ****
  • Posts: 248
  • Me & My Little Sis!!
    • Pepper Ridge North Valley  Weather and Lightning
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #9 on: April 21, 2015, 02:09:55 PM »
Hi Ken,

Thank you for the correction  =D&gt; the updated page can be seen at:
http://www.pepperridgenorthvalley.com/uv-page.php

I see the problem was caused by the misplacement of this bit of the code:
Code: [Select]
if(!function_exists('langtransstr')) {
// shim function if not running in template set
function langtransstr($input) { return($input); }

}

Thanks for the updated get-UV-forecast-inc.php file I had version 6 on my site but had renamed it get-UV-forecast.php and I figured out the problem with the images they were also on my site and in the ./UVimages/ directory  but case sensitivity prevented them from being properly read so I change the name of each .gif from; UV01.gif....UV11.gif to uv01.gif.....uv11.gif and then the script  :-) found them.

Thank you again for all your help fixing this. now I will have play :roll: around with fixing the earthquake and get that working too...

Jeanette
« Last Edit: April 21, 2015, 02:13:52 PM by AZmonsooncats »
"Some dreams are in the night time, And some seem like yesterday
But leaves turn brown and fade, Ships sail away
You long to say a thousand words…but Seasons Change."



CWOP:CW3794, MesoWest: C3794, Facebook: https://www.facebook.com/PepperRidgeNorthValleyWX/

Offline mkutche

  • Forecaster
  • *****
  • Posts: 1041
    • GosportWx.com
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #10 on: November 11, 2017, 03:40:01 AM »
I'm getting this error Notice: Undefined offset: 1 in /home/mkutche/public_html/get-UV-forecast-inc.php on line 217

http://gosportwx.com/wxuvforecast.php
« Last Edit: November 11, 2017, 04:03:40 AM by mkutche »
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #11 on: November 11, 2017, 11:34:36 AM »
On your raspberry Pi server, you are running a really old PHP (5.4.45-0+deb7u11).  On PHP 7.1, the message doesn't appear.

You can also try changing
Code: [Select]
   if (is_numeric(trim($matches[1][1]))) {
to
Code: [Select]
   if (isset($matches[1][1]) and is_numeric(trim($matches[1][1]))) {
« Last Edit: November 11, 2017, 11:39:47 AM by saratogaWX »
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 saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9244
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #12 on: November 11, 2017, 01:55:46 PM »
I decided to update the get-UV-forecast-inc.php script to V1.08 - 11-Nov-2017 to add that fix, and switch the fetch to use curl instead.  The latter is for when temis.nl finally gets around to using https (they don't currently), the script will work then too.
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 mkutche

  • Forecaster
  • *****
  • Posts: 1041
    • GosportWx.com
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #13 on: November 11, 2017, 11:08:24 PM »
Cool that fixed the issue! I'll see if i can update to the latest version of php so nothin like this happens again.

Thanks
Mike
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

Offline tmabell

  • Forecaster
  • *****
  • Posts: 391
    • Mishawaka Weather
Re: Help fixing some old outdated scripts - UV and the Earthquake script
« Reply #14 on: February 24, 2021, 01:39:10 PM »
This is a very old post but I thought I'd add on as opposed to beginning a new post in order to make it easier to see exactly what code we're talking about.  I cobbled this script together by using code in prior posts because I could not find it anywhere.  I have everything pretty much working except the Estimated time to sunburn filed is not populated.  I'm using Cumulus if that makes a difference.

Obviously, I have some aesthetics to deal with  ](*,)

https://mymishawakaweather.com/work21.php


 

anything