Page 1 of 1

error in tnetwebtags.php?

Posted: Fri 07 May 2010 2:19 am
by n9mfk
Notice: Undefined offset: 1 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 294

Notice: Undefined offset: 1 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 298

Notice: Undefined offset: 2 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 302

Notice: Undefined offset: 3 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 302

Notice: Undefined offset: 4 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 302

Notice: Undefined offset: 2 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 303

Notice: Undefined offset: 3 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 303

Notice: Undefined offset: 4 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 303
Hi all,
How can I fix these error
http://www.n9mfk.com/tnetwebtags.php

Notice: Undefined offset: 1 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 305

Notice: Undefined offset: 2 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 305

Notice: Undefined offset: 3 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 305

Notice: Undefined offset: 4 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 306

Notice: Undefined offset: 1 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 307

Notice: Undefined offset: 2 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 307

Notice: Undefined offset: 3 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 307

Notice: Undefined offset: 4 in /virtual/users/e15744-16642/web/tnetwebtags.php on line 308

Re: error in tnetwebtags.php?

Posted: Fri 07 May 2010 4:02 am
by beteljuice
There is something going wrong with your lat / long decode.

.. Is there some code missing ?

Re: error in tnetwebtags.php?

Posted: Fri 07 May 2010 12:06 pm
by gemini06720
Beau, I think I found the error...

The following code was written before Steve made a modification to the way the latitude/longitude tags are produced:

Code: Select all

preg_match  ( '/^(.) (.*)° (.*)\' (.*)&quot/',
  preg_replace('/ /', ' ', $WX['latitude']), $latinfo);
preg_match  ( '/^(.) (.*)° (.*)\' (.*)&quot/',
  preg_replace('/ /', ' ', $WX['longitude']), $longinfo);
Replace the above code with:

Code: Select all

preg_match  ( '/^(.) (.*)° (.*)' (.*)&quot/', preg_replace('/ /', ' ', $WX['latitude']), $latinfo);
preg_match  ( '/^(.) (.*)° (.*)' (.*)&quot/', preg_replace('/ /', ' ', $WX['longitude']), $longinfo);
That should correct the problem... ;)

Re: error in tnetwebtags.php?

Posted: Fri 07 May 2010 12:18 pm
by n9mfk
Here The code
im not sure what missing

Code: Select all

<?php
ini_set('display_errors', 1);  
error_reporting(E_ALL);
/*********************************************************************
   A Project of TNET Services, Inc.

   Project:    Cumulus Project 
   Module:     tnetwebtags.php
   Version:    2.6.1 - 2010-01-30
   Purpose:    Provides a list of Cumulus Web Tag values in an array

   Information obtained from Cumulus Weather Software Help Screen
   
   License:    

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
   USA.

   Installation:

   Please refer to the following web page for installation instructions

   http://cumulus.tnetweather.com/projects/tnetwebtags

tabs = 4
**************************************************************************/

// Set Defaults and check switches

$WX = array();
$WX['webtagversion']    = 'v2.6.1 - 2010-01-30';

check_sourceview();     # check for source view switch

// Date, time values

$WX['time']             = '<#time>';        // Full time ie 18:30 on 25 Dec 2009
$WX['day']              = '<#day>';         // Day 2 digit ie  25
$WX['dayname']          = '<#dayname>';     // Day name ie Friday
$WX['shortdayname']     = '<#shortdayname>';// Short Day ie Fri
$WX['month']            = '<#month>';       // Month 2 digit ie 12
$WX['monthname']        = '<#monthname>';   // Month full name ie December
$WX['shortmonthname']   = '<#shortmonthname>';  // Month short name ie Dec
$WX['year']             = '<#year>';        // Year 4 digit ie 2009
$WX['shortyear']        = '<#shortyear>';   // Year 2 digit ie 09
$WX['hour']             = '<#hour>';        // Hour 24hr 2 digit ie 23
$WX['minute']           = '<#minute>';      // Minute 2 digit ie 09
$WX['date']             = '<#date>';        // Full date ie 12/25/2010

// Forecast info

$WX['forecast']         = '<#forecast>';    // Forecast ie Fine weather
$WX['forecastnumber']   = '<#forecastnumber>';  // Refence documentation
$WX['currcond']         = '<#currcond>';    // Current conditon as wet in Cumulus
$WX['cloudbase']        = '<#cloudbase>';   // Potential Cloud Height

// Basic Weather Values ** values based on unit types

$WX['temp']             = '<#temp>';        // Outside temp
$WX['intemp']           = '<#intemp>';      // Inside temp
$WX['temptrend']        = '<#temptrend>';   // Trend over last hour
$WX['temptrendtext']    = '<#temptrendtext>'; // Values set it strings.ini
$WX['temptrendenglish'] = '<#temptrendenglish>'; 
                            // English version of trend ie Rising/Falling/Steady

$WX['hum']              = '<#hum>';         // Ouside humidity
$WX['inhum']            = '<#inhum>';       // Inside humidity

$WX['heatindex']        = '<#heatindex>';   // Heat Index
$WX['humidex']          = '<#humidex>';     // Humidex
$WX['wchill']           = '<#wchill>';      // Wind Chill (less than 50 deg > 5mph)

$WX['press']            = '<#press>';       // Sea Level pressure
$WX['presstrend']       = '<#presstrend>';  // Defined in strings.ini
$WX['presstrendenglish'] = '<#presstrendenglish>';  // Rising/Falling/Steady
$WX['presstrendval']    = '<#presstrendval>';   // Value value ie +0.01
$WX['altimeterpressure'] = '<#altimeterpressure>'; // Altimeter Setting
$WX['dew']              = '<#dew>';         // Dew Point

// Various Wind related Values

$WX['wspeed']           = '<#wspeed>';      // Current windspeed
$WX['wlatest']          = '<#wlatest>';     // Latest wind speend from console
$WX['wgust']            = '<#wgust>';       // Current wind gust

$WX['bearing']          = '<#bearing>';     // Wind Bearing decimal
$WX['bearingTM']        = '<#bearingTM>';   // Time current wind bearing occurred
$WX['avgbearing']       = '<#avgbearing>';  // Avg Bearing last 10 mins decimal
$WX['wdir']             = '<#wdir>';        // Wind direction compass word ie ESE

$WX['beaufort']         = '<#beaufort>';    // Beaufort wind value ie F8
$WX['beaudesc']         = '<#beaudesc>';    // Beaufort Word Value ie Gale

$WX['windrun']          = '<#windrun>';     // Wind Run so far today
$WX['windrunY']         = '<#windrunY>';    // Wind Run YESTERDAY

// Percipitation Info

$WX['rrate']            = '<#rrate>';       // Current Rain fall rate
$WX['rfall']            = '<#rfall>';       // Rainfall today
$WX['rfallY']           = '<#rfallY>';      // Rainfall YESTERDAY
$WX['rmidnight']        = '<#rmidnight>';   // Rainfall since Midnight
$WX['rhour']            = '<#rhour>';       // Rainfall In last hour
$WX['rmonth']           = '<#rmonth>';      // Rainfall so far this Month
$WX['ryear']            = '<#ryear>';       // Rainfall so far this Year

// Solar Information

$WX['ET']               = '<#ET>';          // Todays Evapotranspiration
$WX['UV']               = '<#UV>';          // Current UV Index
$WX['SolarRad']         = '<#SolarRad>';    // Current Solar Radiation M/w2

// High/Low Values

$WX['tempTH']           = '<#tempTH>';      // Today High
$WX['TtempTH']          = '<#TtempTH>';     // time of that event
$WX['tempTL']           = '<#tempTL>';      // Today Low temp
$WX['TtempTL']          = '<#TtempTL>';     // time of that event

$WX['tempYH']           = '<#tempYH>';      // Yesterdays High
$WX['TtempYH']          = '<#TtempYH>';     // time of that event
$WX['tempYL']           = '<#tempYL>';      // Yesterdays Low
$WX['TtempYL']          = '<#TtempYL>';     // time of that event

$WX['pressTH']          = '<#pressTH>';     // Todays High Pressure
$WX['TpressTH']         = '<#TpressTH>';    // time of that event
$WX['pressTL']          = '<#pressTL>';     // Todays Low Pressure
$WX['TpressTL']         = '<#TpressTL>';    // time of that event

$WX['pressYH']          = '<#pressYH>';     // Yeserdays High Pressure
$WX['TpressYH']         = '<#TpressYH>';    // time of that event
$WX['pressYL']          = '<#pressYL>';     // Yeserdays Low Pressure
$WX['TpressYL']         = '<#TpressYL>';    // time of that event

$WX['windTM']           = '<#windTM>';      // Todays High Wind
$WX['TwindTM']          = '<#TwindTM>';     // time of that event

$WX['windYM']           = '<#windYM>';      // Yesterdays High Wind
$WX['TwindYM']          = '<#TwindYM>';     // time of that event

$WX['wgustTM']          = '<#wgustTM>';     // Todays high wind gust
$WX['TwgustTM']         = '<#TwgustTM>';    // time of that event

$WX['wgustYM']          = '<#wgustYM>';     // Yesterdays high wind gust
$WX['TwgustYM']         = '<#TwgustYM>';    // time of that wind gust

$WX['rrateTM']          = '<#rrateTM>';     // Todays high rainfall rate
$WX['TrrateTM']         = '<#TrrateTM>';    // Time of that event

$WX['rrateYM']          = '<#rrateYM>';     // Yesterdays high rainfall rate
$WX['TrrateYM']         = '<#TrrateYM>';    // time of that event

$WX['bearingTM']        = '<#bearingTM>';   // Time current wind bearing occurred

$WX['bearingYM']        = '<#bearingYM>';   // Yesterdays Avg wind bearing

$WX['Tbeaufort']        = '<#Tbeaufort>';   // Todays High Beafort value

$WX['Ybeaufort']        = '<#Ybeaufort>';   // Yesterdays High Beaufort value

// All Time Values and related values

$WX['tempH']            = '<#tempH>';       // All time high temp
$WX['TtempH']           = '<#TtempH>';      // Date of that event 3:05 PM on 28 July 2009
$WX['mintempH']         = '<#mintempH>';    // All time Minimum High Temp
$WX['TmintempH']        = '<#TmintempH>';   // Date of that event

$WX['tempL']            = '<#tempL>';       // All time low temp
$WX['TtempL']           = '<#TtempL>';      // Date of that event
$WX['maxtempL']         = '<#maxtempL>';    // All time Low Max Temp
$WX['TmaxtempL']        = '<#TmaxtempL>';   // Date of that event

$WX['pressH']           = '<#pressH>';      // All time high Pressure
$WX['TpressH']          = '<#TpressH>';     // Date of that event
$WX['pressL']           = '<#pressL>';      // All time Low Pressure
$WX['TpressL']          = '<#TpressL>';     // Date of that event

$WX['gustM']            = '<#gustM>';       // All time High Wind Gust
$WX['TgustM']           = '<#TgustM>';      // Date of that event
$WX['wspeedH']          = '<#wspeedH>';     // All time high avg windwind speed
$WX['TwspeedH']         = '<#TwspeedH>';    // Date of that event

$WX['wchillH']          = '<#wchillH>';     // All time Wind Chill lowtemperature)
$WX['TwchillH']         = '<#TwchillH>';    // Date of that event

$WX['rrateM']           = '<#rrateM>';      // All time Rain Rate
$WX['TrrateH']          = '<#TrrateM>';     // Date of that event

$WX['rfallH']           = '<#rfallH>';      // All time high daily rain
$WX['TrfallH']          = '<#TrfallH>';     // Date of that event

$WX['rfallhH']          = '<#rfallhH>';     // All time High hourly rain
$WX['TrfallhH']         = '<#TrfallhH>';    // Date of that event

$WX['rfallmH']          = '<#rfallmH>';     // All time Monthly Rain
$WX['TrfallmH']         = '<#TrfallmH>';    // Date of that event

// Value Unit used in data

$WX['tempunit']         = '<#tempunit>';    // Temp Units ie F or C  
$WX['pressunit']        = '<#pressunit>';   // Pressure Units
$WX['windunit']         = '<#windunit>';    // Wind Speed Units
$WX['windrununit']      = '<#windrununit>'; // Wind Run Units
$WX['rainunit']         = '<#rainunit>';    // Rain Units

// Special WMR928 sensor values

$WX['ExtraTemp1']       = '<#ExtraTemp1>';  // Extra Temp 1
$WX['ExtraTemp2']       = '<#ExtraTemp2>';  // Extra Temp 2
$WX['ExtraTemp3']       = '<#ExtraTemp3>';  // Extra Temp 3
$WX['ExtraDP1']         = '<#ExtraDP1>';    // Extra Dewpt 1
$WX['ExtraDP2']         = '<#ExtraDP2>';    // Extra Dewpt 2
$WX['ExtraDP3']         = '<#ExtraDP3>';    // Extra Dewpt 3
$WX['ExtraHum1']        = '<#ExtraHum1>';   // Extra Hum 1
$WX['ExtraHum2']        = '<#ExtraHum2>';   // Extra Hum 2
$WX['ExtraHum3']        = '<#ExtraHum3>';   // Extra Hum 3

// Cumulus Alarm State Flags

$WX['HighTempAlarm']    = '<#HighTempAlarm>';       // High Temp Alarm
$WX['LowTempAlarm']     = '<#LowTempAlarm>';        // Low Temp Alarm

$WX['HighPressAlarm']   = '<#HighPressAlarm>';      // High Temp Alarm
$WX['LowPressAlarm']    = '<#LowPressAlarm>';       // Low Temp Alarm


$WX['HighRainTodayAlarm'] = '<#HighRainTodayAlarm>';  // High Rain Rate Alarm
$WX['HighRainRateAlarm'] = '<#HighRainRateAlarm>';      // High Rain Fall Alarm

$WX['HighWindGustAlarm'] = '<#HighWindGustAlarm>';      // High Wind Gust Alarm
$WX['HighWindSpeedAlarm'] = '<#HighWindSpeedAlarm>';  // High Wind Speed Alarm

// Full stop decimal replacement values.  Correspond to same values with RC Removed

$WX['RCtemp']           = '<#RCtemp>';      // Outside temp
$WX['RCintemp']         = '<#RCintemp>';    // Inside temp
$WX['RCtempTH']         = '<#RCtempTH>';    // Todays Outside High Temp
$WX['RCtempTL']         = '<#RCtempTL>';    // Todays Outside Low Temp

$WX['RCheatindex']      = '<#RCheatindex>'; // Heat Index
$WX['RCdew']            = '<#RCdew>';       // DewPt
$WX['RCwchill']         = '<#RCwchill>';    // Windchill

$WX['RChum']            = '<#RChum>';       // Outside Humidity
$WX['RCinhum']          = '<#RCinhum>';     // Inside Humidity

$WX['RCpress']          = '<#RCpress>';     // Pressure
$WX['RCpressTH']        = '<#RCpressTH>';   // Time High Pressure
$WX['RCpressTL']        = '<#RCpressTL>';   // Time Low Pressure

$WX['RCrfall']          = '<#RCrfall>';     // Rainfall
$WX['RCrrate']          = '<#RCrrate>';     // Rainfall Rate
$WX['RCrrateTM']        = '<#RCrrateTM>';   // Time of todays High Rainfall

$WX['RCwspeed']         = '<#RCwspeed>';    // Windspeed
$WX['RCwgust']          = '<#RCwgust>';     // Wind Gust
$WX['RCwgustTM']        = '<#RCwgustTM>';   // Todays High Gust

// Miscellaneous Values

$WX['version']          = '<#version>';     // Cumulus Version
$WX['build']            = '<#build>';       // Cumulus Version Build

$WX['interval']         = '<#interval>';    // Update Interval

$WX['update']           = '<#update>';      // Date and time of last update

$WX['stationtype']      = '<#stationtype>'; // Type of Station

$WX['latitude']         = "<#latitude>";    // Station Lattitude ie N 33° 24' 09"
$WX['longitude']        = "<#longitude>";   // Station Longitude ie W 111° 52' 59"

// Obtain Usable Data from Latitude and Longitude

preg_match  ( '/^(.) (.*)&deg; (.*)\' (.*)&quot/', 
  preg_replace('/&nbsp;/', ' ', $WX['latitude']), $latinfo);
preg_match  ( '/^(.) (.*)&deg; (.*)\' (.*)&quot/', 
  preg_replace('/&nbsp;/', ' ', $WX['longitude']), $longinfo);

$asign = $osign = "";

if($latinfo[1]=="S") {
  $ssign = "-";
} 

if($longinfo[1]=="W") {
  $osign = "-";
}

$WX['latdec']           = $asign . DMStoDEC($latinfo[2],$latinfo[3],$latinfo[4]);
$WX['longdec']          = $osign . DMStoDEC($longinfo[2],$longinfo[3],$longinfo[4]);

$WX['latdeg']           = $latinfo[1] . ' ' . $latinfo[2] . 'deg ' . $latinfo[3] . 
                            'min ' . $latinfo[4] . 'sec';
$WX['longdeg']          = $longinfo[1] . ' ' . $longinfo[2] . 'deg ' . $longinfo[3] . 
                            'min ' . $longinfo[4] . 'sec';
// End of Calculations

$WX['altitude']         = '<#altitude>';    // Station Altitude

$WX['location']         = '<#location>';    // Station Name/Location
$WX['longlocation']     = '<#longlocation>';// Station Locations

$WX['forum']            = '<#forum>';       // URL for Forum Page
$WX['webcam']           = '<#webcam>';      // URL to Webcam page

$WX['battery']          = '<#battery>';     // Console Battry level (Davis Only)
$WX['txbattery']        = '<#txbattery>';   // TX Battery Status (Davis Only)

$WX['recordsbegandate'] = '<#recordsbegandate>'; // Date that records began on station
$WX['graphperiod']      = '<#graphperiod>';  // Time covered by Generated Graphs
$WX['realtimeinterval'] = '<#realtimeinterval>'; // Realtime Update Interval
$WX['rollovertime']     = '<#rollovertime>'; // Rollover time: Midnight, 9am, 10am
$WX['snowdepth']        = '<#snowdepth>';   // Manual entered Snow for today

// Astrological Information

$WX['sunrise']          = '<#sunrise>';     // Sunrise time at station
$WX['sunset']           = '<#sunset>';      // Sunset time at Station

$WX['moonphase']        = '<#moonphase>';   // Current phase of Moon
$WX['moonrise']         = '<#moonrise>';    // Moonrise time (may be ---)
$WX['moonset']          = '<#moonset>';     // Moonset time (may be ---)

$WX['daylength']        = '<#daylength>';   // Length of Day
$WX['tomorrowdaylength'] = '<#tomorrowdaylength>'; // Tomorrows Length of Day
$WX['dawn']             = '<#dawn>';        // Start of Civil Dawn
$WX['dusk']             = '<#dusk>';        // Start of Civil Dusk
$WX['daylightlength']   = '<#daylightlength>';  // Length of day Dawn to Dusk

// Flag Values

$WX['isdaylight']       = '<#isdaylight>';  // 1 if currently daylight
$WX['sensorcontactlost'] = '<#sensorcontactlost>'; 
                                    // Lost sensor Contact (Fine Offset only)

// Next 3 values are CSV comma delimited array containing up to 3600 entries each
// DISABLED IN THIS VERSION

$WX['wdirdata']         = 'DISABLED<#-wdirdata>';    // Wind direction
$WX['wspddata']         = 'DISABLED<#-wspddata>';    // Wind speed
$WX['nextwindindex']    = 'DISABLED<#-nextwindindex>'; // Index of values used above

check_parseview() ;     # check for parse view switch

/*
FUNCTIONS
*/

function check_sourceview () {
    global $SITE;
    
    if ( isset($_GET['view']) && $_GET['view'] == 'sce' ) {
        $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;
    }
}

function check_parseview () {
    global $SITE, $WX;
    
    if ( isset($_GET['parse']) && $_GET['parse'] == 'sce' ) {
    echo '<html><head><title>Parse tnetwebtags.php</title>
    <style>body {background-color: #333333; color: #ffffff; font-family: verdana,san-serif;
        font-size: 70%; }
    .wrapper {border: 2px solid white; margin-left: auto; margin-right: auto; width: 800px; }
    .var {color: #D85000; font-weight: bold; }
    table {background-color: #ffffff; color: #000000; border-collapse: collapse; 
        border: 1px solid #000000; width: 100%; }
    th { text-align: left; padding: 4px; border: 1px solid #000000; background-color: #959595; 
        color: #000000; }
    .field {background-color: #C1C1C1; padding: 4px; padding-left: 10px; font-size: 80%; 
        border: 1px solid #000000; vertical-align: top; }
    .value { background-color: #D1D1D1; padding: 4px; font-size: 80%; 
        border: 1px solid #000000; vertical-align: top; }
    </style></head><body>';
    echo '<h1>Contents: tnetwebtags.php</h1><div class="wrapper"><table><tr><th>Field</th>
        <th>Value</th></tr>' . "\n";
    foreach($WX as $key => $value) { echo '<tr><td class="field">
        $WX[\'<span class="var">' . $key .
    '</span>\']</td><td class="value">' . $value . "</td></tr>\n"; }
    echo '</table></div> <p>tnetwebtags V ' . $WX['webtagversion'] . ' - Scripts 
    by TNET Services, Inc.</p></body></html>'; 
    exit;
    }
}

// Convert Degrees Minutes Seconds to 
// Decimal format

function DMStoDEC($deg,$min,$sec) {
    return $deg+((($min*60)+($sec))/3600);
}    

// Convert Decimal Format to Degrees
// Minutes Seconds...

function DECtoDMS($dec) {

        $vars = explode(".",$dec);
        $deg = $vars[0];
        $tempma = "0.".$vars[1];
        
        $tempma = $tempma * 3600;
        $min = floor($tempma / 60);
        $sec = $tempma - ($min*60);
        
        return array("deg"=>$deg,"min"=>$min,"sec"=>$sec);
}  

/* 
END OF MODULE 
*/


Re: error in tnetwebtags.php?

Posted: Fri 07 May 2010 12:43 pm
by beteljuice
Like Ray / gemini said .....

Change (cut 'n' paste) the few lines of code underneath ..

Code: Select all

// Obtain Usable Data from Latitude and Longitude