Author Topic: error in submit.php, Wflash  (Read 7950 times)

0 Members and 1 Guest are viewing this topic.

Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
error in submit.php, Wflash
« on: April 03, 2009, 01:35:42 PM »
I get the following error i my server error file,

[Fri Apr 03 18:44:13 2009] [error] PHP Notice:  Undefined index:  F in H:\\htdocs\\Flash\\scripts\\submit.php on line 9

This is what submit.php looks like, line 9 in bold.

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 JUL 1997 05:00:00 GMT");

// Please change USERID below to the User ID supplied
// Do NOT alter anything else in this file
if ($_GET["I"]=="userid" ){
  if ($_GET["F"] != ""){
      $fp=fopen("../Data/wflash.txt", "w");
      $TempStr=$_GET["F"];
      $TempStr2=str_replace(" ","+",$TempStr);
      fwrite($fp, "F=".$TempStr2);
   }else{
      $fp=fopen("../Data/wflash2.txt", "w");
      $TempStr=$_GET["S"];
      $TempStr2=str_replace(" ","+",$TempStr);  
      fwrite($fp, "S=".$TempStr2);
   }
   fclose($fp);
}
?>

what is wrong with it?
« Last Edit: March 09, 2010, 05:00:20 PM by Axelvold »
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline jay_hoehn

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 656
    • Jay's Woodcrafts
Re: error in submit.php, Wflash
« Reply #1 on: April 03, 2009, 05:34:36 PM »
Lars,

I compared your submit.php to mine and they are identical.  Your page seems to work on my end.  What seems to be the issue?

Jay
Davis Vantage Pro2 Plus
VVP
Weather Display


Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: error in submit.php, Wflash
« Reply #2 on: April 03, 2009, 05:40:41 PM »
Hi Jay

The page works, but i get an error in the web server log.

[Fri Apr 03 18:44:13 2009] [error] [client 83.209.47.5] PHP Notice:  Undefined index:  F in H:\\htdocs\\Flash\\scripts\\submit.php on line 9

i did try to change F to C but i did not make any diffrent.
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline jay_hoehn

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 656
    • Jay's Woodcrafts
Re: error in submit.php, Wflash
« Reply #3 on: April 03, 2009, 05:49:13 PM »
Lars,

Sorry, I can't help with that.

Jay
Davis Vantage Pro2 Plus
VVP
Weather Display


Offline Meteorologica

  • Contributor
  • ***
  • Posts: 106
Re: error in submit.php, Wflash
« Reply #4 on: April 04, 2009, 03:12:00 AM »
First I must once again emphasize that this is NOT the place to get support for WeatherFlash, you should contact us directly if you require assistance with these sort of problems! http://www.meteorologica.co.uk/contact.asp

However, I will tell you that there is nothing wrong with your script, it is designed to be the way it is. There is no error, the F variable doesn't always exist in the data string. The F does not represent temperature!

Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: error in submit.php, Wflash
« Reply #5 on: April 04, 2009, 04:42:13 AM »
First I must once again emphasize that this is NOT the place to get support for WeatherFlash, you should contact us directly if you require assistance with these sort of problems! http://www.meteorologica.co.uk/contact.asp

However, I will tell you that there is nothing wrong with your script, it is designed to be the way it is. There is no error, the F variable doesn't always exist in the data string. The F does not represent temperature!

if there now is nothing wrong with the script, still remains the question why is the error in the server log?

Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline Meteorologica

  • Contributor
  • ***
  • Posts: 106
Re: error in submit.php, Wflash
« Reply #6 on: April 04, 2009, 05:08:36 PM »
It is not an error it is simply telling you that the variable F is not in the data stream. That is normal, the variables that get sent to the script do change and they are not all present all of the time!

Offline Axelvold

  • Forecaster
  • *****
  • Posts: 1704
    • Axelvold's weather and photo
Re: error in submit.php, Wflash
« Reply #7 on: April 04, 2009, 05:54:15 PM »
ok, thanks for the information
Lars Magnusson
Axelvold / Sweden
55° 57' 41" N / 13° 6' 1" E
WX Station: Davis Vantage Pro2 Plus

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: error in submit.php, Wflash
« Reply #8 on: April 06, 2009, 06:24:59 PM »
And...  you can get rid of the log entry for Notice errors by changing your php.ini to have

error_reporting = E_ALL & ~E_NOTICE

You get the error with 'F' mentioned because the F= is only used to update the wflash2.txt record.

It's also possible to skip the error by adding an isset() to test for the existence of the argument first:

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 JUL 1997 05:00:00 GMT");

// Please change USERID below to the User ID supplied
// Do NOT alter anything else in this file
if (isset($_GET["I"]) && $_GET["I"]=="userid" ){
   if (isset($_GET["F"]) && $_GET["F"] != ""){
      $fp=fopen("../Data/wflash.txt", "w");
      $TempStr=$_GET["F"];
      $TempStr2=str_replace(" ","+",$TempStr);
      fwrite($fp, "F=".$TempStr2);
   }else{
      $fp=fopen("../Data/wflash2.txt", "w");
      $TempStr=$_GET["S"];
      $TempStr2=str_replace(" ","+",$TempStr);   
      fwrite($fp, "S=".$TempStr2);
   }
   fclose($fp);
}
?>

then the script won't log a PHP error even if the arguments are missing and error_reporting = E_ALL 

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