Problem with comparasion.php

Un problème, une question sur la partie PHP des graphiques

Modérateurs : jturlier, Météo Villarzel

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Problem with comparasion.php

Message par Brett001 » 05 déc. 2014, 19:51

Bonjour!

I'm Zoltan from Hungary. Sorry, but I do not speak French, I speak only a little English.
I downloaded the site_model.zip from Meteo Villarzel. I using WAMP 2.4 webserver on my computer as localhost. I do not upload my website to internet. (yet!) :)

c:\wamp\www\site\
that is root:
localhost/site/


I like your site, I was particularly interested in the statistics section (NOAA compare). But don't working, lots of php error messages is the result. :(

I read the instructions, with the WeatherLink created NOAA files and renamed them. (NOAAPRMO.TXT --> december-2014.TXT)

Modified constantes.inc.php :

Code : Tout sélectionner

<?php
# Fichier de configuration
# OBLIGATOIRE Entrez ici le nom de votre site
define ("NOM_SITE","Mon site météo");
# vous pouvez changer l'image de votre logo
define ("LOGO","banniere1.png");
# choisissez la langage que vous souhatez utiliser
# define ("LANGUE","IT");
# define ("LANGUE","ES");
 define ("LANGUE","FR");

# décommentez le style que vous souhaitez appliquer au rendu de ce script
define ('THEME','<script type="text/javascript" src="./highchartsNOAA/themes/dark-blue.js"></script>');
#define ('THEME','<script type="text/javascript" src="./highchartsNOAA/themes/dark-green.js"></script>');
#define ('THEME','<script type="text/javascript" src="./highchartsNOAA/themes/gray.js"></script>');
#define ('THEME','<script type="text/javascript" src="./highchartsNOAA/themes/grid.js"></script>');
#define ('THEME','<script type="text/javascript" src="./highchartsNOAA/themes/skies.js"></script>');

# OBLIGATOIRE Entrez ici le premier jour des enregistrements
define ("PREMIER_JOUR", "11");
define ("PREMIER_MOIS", "12");
define ("PREMIERE_ANNEE", "2014");


# OBLIGATOIRE Entrez ici la version de GW que vous utilisez ( V2 ou V3 ) respectez la casse
# define ('VER','V3'); 
# n'est plus nécessaire, détection par le programme de cette information



# OBLIGATOIRE Entrez ici le type de fichiers NOAA utilis&#65533;s
#   GW pour GraphWeather
#   WL pour WeatherLink
#   AUTRE pour un autre logiciel source
#   Si la source n'est pas GW, vous devez nommer vos fichiers NOAA mois-AAAA.TXT et AAAA.TXT
#     où mois est le nom du mois en clair (Janvier, Février, Mars, etc) avec majuscule et accent
#     où; AAAA est l'année en clair (2008, 2009, etc)
#     TXT doit &#65533;tre en majuscule
define ("TYPE_NOAA", "WL"); 

# OBLIGATOIRE Entrez ici si vous possédez une sonde solaire (TRUE ou FALSE)
define ("SONDE_SOL", "TRUE");
# define ("SONDE_SOL", "TRUE");

# OBLIGATOIRE Entrez ici le chemin du répertoire contenant les statistiques GW

#define ("REP_GW", "../Statistics/");


# OBLIGATOIRE  si la source n'est pas GW Entrez ici le chemin du répertoire contenant les fichiers NOAA
define ("REP_NOAA", "../NOAAcompare/");

# OBLIGATOIRE Entrez ici si vous possédez un fichier contenant les Normales (TRUE ou FALSE)
#   Ce fichier doit s'appeller Normales.TXT et contenir les valeurs sous forme NOAA
#   Ces valeurs Normales et records sont disponibles sur le site de METEO FRANCE
#   COMMENT contient un commentaire décrivant la source des Normales.
define ("FICHE_NORMALES", "FALSE");
# define ("FICHE_NORMALES", "TRUE");
 
 # option spéciale mistral
 # define ("MISTRAL", "FALSE");
 # define ("MISTRAL_V", 50);Non programmé
 # define ("MISTRAL_D", "N");Non programmé
 define ("MISTRAL", "TRUE");
?>
What is wrong? I attached php error.txt list and my directory structure screenshots in a zip file.
Thank you in advance for your help.
Vous n’avez pas les permissions nécessaires pour voir les fichiers joints à ce message.
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Avatar du membre
Météo Villarzel
Administrateur du site
Messages : 524
Enregistré le : 06 févr. 2014, 09:48
Contact :

Re: Problem with comparasion.php

Message par Météo Villarzel » 05 déc. 2014, 20:43

Hi Zoltan,
good morning to Hungary.
You use GraphWeather or WeatherLink?


define ("TYPE_NOAA", "WL");

if you use WeatherLink, indicate the directory to your file NOAA

# OBLIGATOIRE si la source n'est pas GW Entrez ici le chemin du répertoire contenant les fichiers NOAA
define ("REP_NOAA", "C:\WeatherLink\***\");

A +
Station Vantage Pro2+ avec station agricole - Weatherlink - GraphWeather 3.0.15b - Cumulus 1.9.4 - Windows 7/64
Graphique dynamique à partir d'une bd MySql - VP2SQL

Image

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Re: Problem with comparasion.php

Message par Brett001 » 05 déc. 2014, 23:56

Hi!

I using WeatherLink.

define ("TYPE_NOAA", "WL"); ---> I fixed

but if modified this:

# OBLIGATOIRE si la source n'est pas GW Entrez ici le chemin du répertoire contenant les fichiers NOAA
define ("REP_NOAA", "C:\WeatherLink\***\"); ---> Dreamweaver: syntax error, and the php errors still is repeating.

Zoltan
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Avatar du membre
Météo Villarzel
Administrateur du site
Messages : 524
Enregistré le : 06 févr. 2014, 09:48
Contact :

Re: Problem with comparasion.php

Message par Météo Villarzel » 06 déc. 2014, 00:00

define ("REP_NOAA", "you must put your path to your files NOAA");

A+
Station Vantage Pro2+ avec station agricole - Weatherlink - GraphWeather 3.0.15b - Cumulus 1.9.4 - Windows 7/64
Graphique dynamique à partir d'une bd MySql - VP2SQL

Image

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Re: Problem with comparasion.php

Message par Brett001 » 06 déc. 2014, 13:56

Hi!

Today I installed and tried the Graph Weather 2.0.231.

Modified the constantes.inc.php:

# OBLIGATOIRE Entrez ici la version de GW que vous utilisez ( V2 ou V3 )
# respectez la casse
define ('VER','V2');

# TXT doit &#65533;tre en majuscule
define ("TYPE_NOAA", "GW");

# OBLIGATOIRE Entrez ici le chemin du répertoire contenant les statistiques GW

define ("REP_GW", "../Statistics/");


# OBLIGATOIRE si la source n'est pas GW Entrez ici le chemin du répertoire contenant les fichiers NOAA
# define ("REP_NOAA", "../NOAA/");

Uploading with Graph Weather FTP exports to the corresponding directories based on the instruction. http://www.boock.ch/meteo/tuto_nouveau_ ... ite_02.php
Uploading success!
Everything works great (graphique sur 48h, statistiques GW etc.) except comparasion.php. :( :( Again and again php errors! :evil:

I tried in constantes.inc.php changing the paths (example: define ("REP_GW", "../site/Statistics/" or .../www/site/Statistics/); ) But no effect, not working. I'm angry!!
It's possible that the path is not the problem? Please look thoroughly the php error list of what I attched in first comment.
Thanks and have nice day!
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Avatar du membre
PascalWMR
Messages : 323
Enregistré le : 16 févr. 2014, 09:28
Localisation : CONFLANS EN JARNISY (F54800)
Contact :

Re: Problem with comparasion.php

Message par PascalWMR » 06 déc. 2014, 15:21

Hi!

Looking at your error file if I reminds me, I got this error.
This is an error in the php code mensuelcompareH.php files, mensuelcompareH1.php.
If memory serves, this is the mA variable that does not exist and I have to change the code of the 2 files.

Along the modified code of 2 files. You can test by replacing the code your files mine.

Nevertheless made a backup of the original files before.

php code of mensuelcompareH.php

Code : Tout sélectionner

<?php
#Version Universelle V2

#######################################
# Récupération du formulaire et tests #
#######################################
$mois[1] = (isset ($_GET['mois1'])) ? $_GET['mois1'] : "";
$annee[1] = (isset ($_GET['annee1'])) ? $_GET['annee1'] : "";
$mois[2] = (isset ($_GET['mois2'])) ? $_GET['mois2'] : "";
$annee[2] = (isset ($_GET['annee2'])) ? $_GET['annee2'] : "";

for ($j=1;$j<3;$j++){$moisA[$j]= gtmois($mois[$j]);}

if ($annee[1]=="" && $annee[2]=="" && $mois[1]=="" && $mois[2]=="") {$vide=1;} else {$vide=0;}
//echo $mois[1]." ".$tabmois[$moisch[1]-1]." ".array_search($mois[1], $tabmois1)+1;;
if ($annee[1]=="") {$annee[1]=date("Y");}
if ($mois[1]=="") {$moisch[1]=date("m"); $mois[1]=$tabmois[$moisch[1]-1];} else {$moisch[1] = array_search($mois[1], $tabmois)+1;}
if ($annee[2]=="") {$annee[2]=date("Y");}
if ($mois[2]=="") {$moisch[2]=date("m"); $mois[2]=$tabmois[$moisch[2]-1];} else {$moisch[2] = array_search($mois[2], $tabmois)+1;}
//echo $mois[1];
//echo $mois[2];
for ($j=1;$j<3;$j++){$moisA[$j]= gtmois($mois[$j]);}
//echo $moisA[1];
//echo $moisA[2];
if ($vide==1) {$titre = "$lx_choice_mths";}
   else {$titre = "<HR width=50%>$lx_comp".$moisA[1]." ".$annee[1].$lx_with.$moisA[2]." ".$annee[2]."<BR><HR width=50%>";}

$moisch[1] = substr((100+$moisch[1]),1);
$moisch[2] = substr((100+$moisch[2]),1);
if (TYPE_NOAA == "GW") {
  $fichier[1] = REP_GW.$annee[1]."/".$moisch[1]."/".$annee[1]."_".$moisch[1]."_NOAA.txt";
  $fichier[2] = REP_GW.$annee[2]."/".$moisch[2]."/".$annee[2]."_".$moisch[2]."_NOAA.txt";
  }

if (TYPE_NOAA == "WL") {
  if ($moisch[1]==date("m") && $annee[1]==date("Y")) {$fichier[1]=REP_NOAA."NOAAMO.TXT";}
    else {$fichier[1] = REP_NOAA.$mois[1]."-".$annee[1].".TXT";}
  if ($moisch[2]==date("m") && $annee[2]==date("Y")) {$fichier[2]=REP_NOAA."NOAAMO.TXT";}
    else {$fichier[2] = REP_NOAA.$mois[2]."-".$annee[2].".TXT";}}
if (TYPE_NOAA == "AUTRE") {
  $fichier[1] = REP_NOAA.$mois[1]."-".$annee[1].".TXT";
  $fichier[2] = REP_NOAA.$mois[2]."-".$annee[2].".TXT";}
  
  

if ($vide==1) {echo"<Font size='5'><b>$titre</b><br></Font>";}
echo"
<form method='get' action='NOAA.php'>
$lx_comp_r
<select size='1' name='mois1'>
  <option value=''>$lx_mth
  <option>$tabmois[0]</option>
  <option>$tabmois[1]</option>
  <option>$tabmois[2]</option>
  <option>$tabmois[3]</option>
  <option>$tabmois[4]</option>
  <option>$tabmois[5]</option>
  <option>$tabmois[6]</option>
  <option>$tabmois[7]</option>
  <option>$tabmois[8]</option>
  <option>$tabmois[9]</option>
  <option>$tabmois[10]</option>
  <option>$tabmois[11]</option>
</select>
<select size='1' name='annee1'>
  <option value=''>$lx_yr";
  for ($i=PREMIERE_ANNEE;$i<=date('Y');$i++) {
    echo "<option>$i";}
echo "
</select>
 $lx_with 
<select size='1' name='mois2'>
  <option value=''>$lx_mth
  <option>$tabmois[0]</option>
  <option>$tabmois[1]</option>
  <option>$tabmois[2]</option>
  <option>$tabmois[3]</option>
  <option>$tabmois[4]</option>
  <option>$tabmois[5]</option>
  <option>$tabmois[6]</option>
  <option>$tabmois[7]</option>
  <option>$tabmois[8]</option>
  <option>$tabmois[9]</option>
  <option>$tabmois[10]</option>
  <option>$tabmois[11]</option>
</select>
<select size='1' name='annee2'>
  <option value=''>$lx_yr";
  for ($i=PREMIERE_ANNEE;$i<=date('Y');$i++) {
    echo "<option>$i";}
echo "
</select>
<input type='hidden' name='period' value='c_mensuel'>
<input type='submit' value='Go'></form>";
if ($vide==0) {echo"<Font size='5'><b>$titre</b></Font>";}
 
if ($vide==1) {exit;}

$spaces = array("     ","    ","   ","  ");
$space = array(" "," "," "," ");
for ($j=1;$j<3;$j++){$moisA[$j]= gtmois($mois[$j]);}

for ($index=1; $index<3; $index++) {
  $fp = @fopen ("$fichier[$index]",r) or die("<BR><Div class='titre'>Les données n'existent pas pour ".$mois[$index]." ".$annee[$index].".<BR>Choisissez une autre période.</Div>");
  $content = fread ($fp,filesize("$fichier[$index]"));
  fclose ($fp);

  $content = str_replace("\r","",$content);
  $separ_1[$index] = explode("----------\n",$content); 
  $separ_2[$index] = explode("\n----------",$separ_1[$index][1]); 
  $table[$index] =$separ_2[$index][0];
  $nb[$index] = substr_count ($table[$index], "\n");
  $line[$index] = explode("\n",$table[$index]);
  for($j=0;$j<sizeof($line[$index]);$j++){
    $line[$index][$j]=" ".$line[$index][$j];
    $line[$index][$j] = str_replace($spaces,$space,$line[$index][$j]);}
}

$char = array (" ","W");
$newchar = array ("","O");

	$gel = array (1=>0,2=>0);
	$fortgel = array (1=>0,2=>0);
	$sansdegel = array (1=>0,2=>0);
	$chaleur = array (1=>0,2=>0);
	$canicule = array (1=>0,2=>0);
	$pluie = array (1=>0,2=>0);
	$pluie_1 = array (1=>0,2=>0);
	$pluie_5 = array (1=>0,2=>0);
	$pluie_10 = array (1=>0,2=>0);
	$maxsoleil = array (1=>0,2=>0);
	$jourmaxsoleil = array(1=>"",2=>"");
	$maxrain = array (1=>0,2=>0);
	$maxvent = array (1=>0,2=>0);
	$venteux = array (1=>0,2=>0);
	$meantemp_max = array (1=>-100,2=>-100);
	$meantemp_min = array (1=>100,2=>100);
	$lowtemp_max = array (1=>-100,2=>-100);
	$hightemp_min = array (1=>100,2=>100);
	$lowtemptotal = array (1=>0,2=>0);
	$hightemptotal = array (1=>0,2=>0);
	$soleiltotal = array (1=>0,2=>0);
	$pluietotal = array (1=>0,2=>0);
	$amplitude_max = array (1=>0,2=>0);
	$amplitude_min = array (1=>100,2=>100);
	$uv_index = array (1=>100,2=>100);
	$uv_minmax = array (1=>100,2=>100);
	$uv_avg = array (1=>100,2=>100);

##############################################
# Récupération des moyennes et maxi mensuels #
##############################################
for ($index=1; $index<3; $index++) {
  $bilan =" ".$separ_1[$index][2];
  $bilan = explode ("\n",$bilan);
  $bilan[0] = str_replace($spaces,$space,$bilan[0]);
  $value = explode(" ",$bilan[0]);
  $meantemp_m[$index] = $value[1];
  $hightemp_max[$index] = $value[2];
  $hourhightemp_max[$index] = $value[3];
  $lowtemp_min[$index] = $value[4];
  $hourlowtemp_min[$index] = $value[5];
  $rain_m[$index] = $value[8];
  $ventmoyen_m[$index] = $value[9];
  $rafales_m[$index] = $value[10];
  $jour_rafales_m[$index] = $value[11];
  $domdir_m[$index] = $value[12];
#Récupération de l'$lx_sunny total
  $fiche = REP_GW.$annee[$index]."/".$moisch[$index]."/".$annee[$index]."_".$moisch[$index].".xml";
  if (file_exists($fiche) && SONDE_SOL=="TRUE") {
    $fp = fopen ("$fiche","r");
    $content = fread ($fp,filesize("$fiche"));
    fclose ($fp);
    $valeur = strstr($content,"<nb-hours-of-sunshine");
    $soleil_m[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,22,12));
    $valeur = strstr($content,"<total-solar-energy");
    $soleilnrj[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,20,14));
    $valeur = strstr($content,"<solar_radiation");
    $valeur = strstr($valeur,"mean");
    $soleilrad[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,5,10));
	//UV index
	
	
	
	}
  else {$soleil_m[$index]=""; $soleilrad[$index]=""; $soleilnrj[$index]="";
		//UV index
		}
  
  
  
}

################################################################
# Récupératuration des autres maxi/mini et calcul des moyennes #
################################################################
for ($index=1; $index<3; $index++) {
   $lowtemptotal=0;
   $hightemptotal=0;
   $soleiltotal=0;
   $pluietotal=0;
for ($i=0; $i<$nb[$index]+1; $i++) {
  $value = explode(" ",$line[$index][$i]);
  $jourch[$index] = substr((100+$value[1]),1);
  if (count($value)>2) {
    $rain[$index] = $value[9];
    $ventmoyen[$index] =  $value[10];
    if ($value[11]>=36) {$venteux[$index]++;}
	$dd =  str_replace("W","O",$value[13]);
	if ($value[11]>=50 && ($dd='NE' or $dd=='NNE' or $dd=='N' or $ddd=='NNO' or $dd=='NO' )) 
	{
		$venteux_mistral[$index]++;
	}  
    $meantemp[$index] = $value[2];
    $lowtemp_day[$index] = $value[6];
    $lowtemp[$index] = $value[5];
    $hightemp[$index] = $value[3];}
  else {   
    $rain[$index] = "";
    $ventmoyen[$index] =  "";
    $meantemp[$index] = "";
    $lowtemp[$index] = "";
    $hightemp[$index] = "";}

  $fichier = REP_GW.$annee[$index]."/".$moisch[$index]."/".$annee[$index]."_".$moisch[$index]."_".$jourch[$index].".xml";
  if (file_exists($fichier) && SONDE_SOL=="TRUE") {
    $fp = fopen ("$fichier","r");
    $content = fread ($fp,filesize("$fichier"));
    fclose ($fp);				
	$z=strpos($content, '<total-rainfall>');
	if ($z>1) {$ver='V2';} else{$ver='V3';}
	//echo $z.'zzxx'.$ver;
 	if ($ver=="V2") 
		{
			$valeur = strstr($content,"<nb-hours-of-sunshine>");
			$soleil[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,22,6));
		}
		else
		{
			$valeur = strstr($content,"<nb-hours-of-sunshine>");
			$val1 = strstr($valeur," value=");
			$soleil[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($val1,7,6));
	
		}
	}
  else {$soleil[$index]="";}

  if ($soleil[$index] > $maxsoleil[$index] && $soleil[$index]!="") {
    $maxsoleil[$index]=$soleil[$index]; $jourmaxsoleil[$index]=$value[1];}
  if ($rain[$index] > $maxrain[$index] && $rain[$index]!="") {
    $maxrain[$index]=$rain[$index]; $jourmaxrain[$index]=$value[1];}
  if ($ventmoyen[$index] > $maxvent[$index] && $ventmoyen[$index]!="") {
    $maxvent[$index]=$ventmoyen[$index]; $jour_vent_max[$index]=$value[1];}
  if ($meantemp[$index] > $meantemp_max[$index] && $meantemp[$index]!="") {$meantemp_max[$index]=$meantemp[$index];}
  if ($meantemp[$index] < $meantemp_min[$index] && $meantemp[$index]!="") {$meantemp_min[$index]=$meantemp[$index];}
  if ($lowtemp[$index] > $lowtemp_max[$index] && $lowtemp[$index]!="") {$lowtemp_max[$index]=$lowtemp[$index];}
  if ($hightemp[$index] < $hightemp_min[$index] && $hightemp[$index]!="") {$hightemp_min[$index]=$hightemp[$index];}

  if ($lowtemp[$index]!="") {$lowtemptotal = $lowtemptotal+$lowtemp[$index];
    $lowtemp_moy[$index] = round(($lowtemptotal/$jourch[$index]), 1);}
  if ($hightemp[$index]!="") {$hightemptotal = $hightemptotal+$hightemp[$index];
    $hightemp_moy[$index] = round(($hightemptotal/$jourch[$index]), 1);}
  if ($soleil[$index]!="") {$soleiltotal = $soleiltotal+$soleil[$index];
    $soleil_moy[$index] = round(($soleiltotal/$jourch[$index]), 1);}
  if ($rain[$index]!="") {$pluietotal = $pluietotal+$rain[$index];
    $pluie_moy[$index] = round(($pluietotal/$jourch[$index]), 1);}

  if ($lowtemp[$index]!="") {
    $amplitude = $hightemp[$index] - $lowtemp[$index];
    if ($amplitude < $amplitude_min[$index]) {$amplitude_min[$index]=$amplitude; $jour_amplitude_min[$index]=$value[1];}
    if ($amplitude > $amplitude_max[$index]) {$amplitude_max[$index]=$amplitude; $jour_amplitude_max[$index]=$value[1];}}

  if ($lowtemp[$index]<='0' && $lowtemp[$index]!="") {$gel[$index]=$gel[$index]+1;}
  if ($lowtemp[$index] <='-5'&& $lowtemp[$index]!="") {$fortgel[$index]=$fortgel[$index]+1;}
  if ($lowtemp[$index]<='0' && $hightemp[$index]<='0' && $lowtemp[$index]!="") {$sansdegel[$index]=$sansdegel[$index]+1;} 
  if ($hightemp[$index] >='30' /*&& $hightemp[$index] <'35'*/) {$chaleur[$index]++;}
  //echo $hightemp[1].'cc'.$chaleur[$index].'<br/>';
  if ($hightemp[$index] >='35') {$canicule[$index]=$canicule[$index]+1;}
  if ($rain[$index]>'0' && $rain[$index]!="") {$pluie[$index]=$pluie[$index] + 1;} 
  if ($rain[$index]>='1' && $rain[$index]<'5' && $rain[$index]!="") {$pluie_1[$index]=$pluie_1[$index]+1;}
  if ($rain[$index]>='5'  && $rain[$index]<'10' && $rain[$index]!="") {$pluie_5[$index]=$pluie_5[$index]+1;}
  if ($rain[$index]>='10' && $rain[$index]!="") {$pluie_10[$index]=$pluie_10[$index]+1;}

  }
}



###################
# Affichage Final #
###################

$xtitre='Jours';
$mensuel=true;
$Xlab=$xlabel;
$monstep='2';
include "traceH.php";
echo"<Table border=0><TR>";

for ($j=1;$j<3;$j++){$moisA[$j]= gtmois($mois[$j]);}

for ($index=1; $index<3; $index++) {
echo "<TD>
<br>
<Table class='rap1'  border=1 width=450>
  <TR bgcolor='#aaaaaa'>
    <TD><Font color='black' size='2'>
	<br><center><B><U><I><Font size='4'>$moisA[$index] $annee[$index]</Font></I></U></B></Center><BR>
	<UL>
	<LI><B>$lx_temp</B>
		<UL class='rap2' >
		<LI>$lx_temp_avg_mth : <span class='stylegrosrouge'>$meantemp_m[$index] °C</span>
		<LI>$lx_temp_avg_min: <span class='stylegrosrouge'>$lowtemp_moy[$index] °C</span>
		<LI>$lx_temp_avg_max: <span class='stylegrosrouge'>$hightemp_moy[$index] °C</span>
		<LI>$lx_tn_mth : <span class='stylegrosrouge'>$lowtemp_min[$index] °C </span>$lx_on<span class='stylegrosrouge'>$hourlowtemp_min[$index]</span>
		<LI>$lx_tx_mth : <span class='stylegrosrouge'>$hightemp_max[$index] °C</span>$lx_on<span class='stylegrosrouge'>$hourhightemp_max[$index]</span>
		<LI>$lx_amp_min : <span class='stylegrosrouge'>$amplitude_min[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jour_amplitude_min[$index]</span>
		<LI>$lx_amp_max : <span class='stylegrosrouge'>$amplitude_max[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jour_amplitude_max[$index]</span><BR>
		</UL>
	</UL>
	<UL>
	<LI><B>$lx_wind</B>
		<UL class='rap2' >
		<LI>$lx_wind_avg_mth :<BR>&nbsp&nbsp&nbsp<span class='stylegrosrouge'>$ventmoyen_m[$index] km/h</span> $lx_wind_sect <span class='stylegrosrouge'>$domdir_m[$index] </span>
		<LI>$lx_wind_max : <span class='stylegrosrouge'>$maxvent[$index] km/h</span>$lx_on<span class='stylegrosrouge'>$jour_vent_max[$index]</span>
		<LI>$lx_raf_max : <span class='stylegrosrouge'>$rafales_m[$index] km/h</span>$lx_on<span class='stylegrosrouge'>$jour_rafales_m[$index]</span>
		<LI>$lx_windy_days ($lx_raf>36 km/h) : <span class='stylegrosrouge'>$venteux[$index]</span>";
		if (MISTRAL=="TRUE"){echo "<LI>$lx_mistral_days ($lx_raf>50 km/h) : <span class='stylegrosrouge'>$venteux_mistral[$index]</span>";}
		echo "</UL></UL>
	<UL>
	<LI><B>$lx_rain</b>
		<UL class='rap2' >
		<LI>$lx_rain_mth : <span class='stylegrosrouge'>$rain_m[$index] mm</span>
		<LI>$lx_rain_day_max <span class='stylegrosrouge'>$maxrain[$index] mm</span>$lx_on<span class='stylegrosrouge'>$jourmaxrain[$index]</span>
		</UL>
	</UL>
	<UL>";
	if (SONDE_SOL=="TRUE") {echo "
	<LI><B>$lx_sunny</B>
		<UL class='rap2' >
		<LI>$lx_nrj_mth <span class='stylegrosrouge'>$soleilnrj[$index] kWh</span>
		<LI>$lx_rad_day_avg <span class='stylegrosrouge'>$soleilrad[$index] W/m²</span>
		<LI>$lx_sunny_mth <span class='stylegrosrouge'>$soleil_m[$index] h</span> ($lx_watt_m2)
		<LI>$lx_rain_day_max <span class='stylegrosrouge'>$maxsoleil[$index] h</span>$lx_on<span class='stylegrosrouge'>$jourmaxsoleil[$index]</span>
		</UL>
	</UL>"
	;}
	echo "
    </td>
  </tr>
</table>
<br>

<table  class='rap2' border=1 width=450>
  <tr bgcolor='#aaaaaa' rawspan='2'>
    <td colspan='2'><Font color='black' size='2'>
	<b><center>$lx_days_nr $moisA[$index] $annee[$index]</center></b>
    </td>
  </tr>
  <tr bgcolor='#cccccc'>
    <td  align='center'>
	<table class='rap2;tableval' border='0'>
	<tr><td>$lx_day_freeze_nb : </td><td><span class='stylegrosrouge'>$gel[$index]</span></td></tr>
	<tr><td>$lx_day_deep_freeze_nb (<=-5) :</td><td><span class='stylegrosrouge'>$fortgel[$index]</span></td></tr>
	<tr><td>$lx_day_icy_nb : </td><td><span class='stylegrosrouge'>$sansdegel[$index]</span></td></tr>
	<tr><td>$lx_day_hot (>=30) :</td><td><span class='stylegrosrouge'>$chaleur[$index]</span></td></tr>
	<tr><td>$lx_day_heatwave (>=35) :</td><td><span class='stylegrosrouge'>$canicule[$index]</span></td></tr>
	</table>
    </td>
    <td  align='center' valign='middle'>
	<table class='rap2'  border='0'>
	<tr><td>$lx_rainy_day :</td><td><span class='stylegrosrouge'>$pluie[$index]</span></td></tr>
	<tr><td>$lx_rain_1to5 :</td><td><span class='stylegrosrouge'>$pluie_1[$index]</span></td></tr>
	<tr><td>$lx_rain_5to10 :</td><td><span class='stylegrosrouge'>$pluie_5[$index]</span></td></tr>
	<tr><td>$lx_rain_over10 :</td><td><span class='stylegrosrouge'>$pluie_10[$index]</span></td></tr>
	</table>
    </td>
  </tr>
</table>
</TD>";
}
echo "</TR></Table>";
?>
</HEAD>
code php of mensuelcompareH1.php

Code : Tout sélectionner

<?php
#Version Universelle V2
#######################################
# Récupération du formulaire et tests #
#######################################




$fichier= array(3);
$mois[1] = (isset ($_GET['mois1'])) ? $_GET['mois1'] : $tabmois[date("m")-1];
$annee[1] = (isset ($_GET['annee1'])) ? $_GET['annee1'] :date("Y");
for ($j=1;$j<3;$j++)
{ gtmois($mois[$j]);
$moisA[$j]=gtmois($mois[$j]);
}


if ($annee[1]=="") 
{
	$annee[1]=date("Y");
}
if ($mois[1]=="") 
{
	$moisch[1]=date("m"); $mois[1]=$tabmois1[$moisch[1]-1];
} 
else 
{
	$moisch[1] = array_search($mois[1], $tabmois)+1;
}

if ($vide==1) 
{
	$titre = "$lx_choice_mth";
}
else 
{
	//$titre = "<HR width=50% > ".$mois[1]." ".$annee[1]."<BR><HR width=50% >";
}

$moisch[1] = substr((100+$moisch[1]),1);

if (TYPE_NOAA == "GW") 
{
	$fichier[1] = REP_GW.$annee[1]."/".$moisch[1]."/".$annee[1]."_".$moisch[1]."_NOAA.txt";
}
if (TYPE_NOAA == "WL") 
{
	if ($moisch[1]==date("m") && $annee[1]==date("Y")) 
	{
		$fichier[1]=REP_NOAA."NOAAMO.TXT";
	}
    else 
	{
		$fichier[1] = REP_NOAA.$mois[1]."-".$annee[1].".TXT";
	}
}
if (TYPE_NOAA == "AUTRE") 
{
	$fichier[1] = REP_NOAA.$mois[1]."-".$annee[1].".TXT";
}

if ($vide==1) 
{
	echo"<Font size='5'><b>$titre</b><br></Font>";
}
echo"
<form method='get' action='NOAA.php'>
<select size='1' name='mois1'>
  <option value=''>$lx_mth
  <option>$tabmois[0]</option>
  <option>$tabmois[1]</option>
  <option>$tabmois[2]</option>
  <option>$tabmois[3]</option>
  <option>$tabmois[4]</option>
  <option>$tabmois[5]</option>
  <option>$tabmois[6]</option>
  <option>$tabmois[7]</option>
  <option>$tabmois[8]</option>
  <option>$tabmois[9]</option>
  <option>$tabmois[10]</option>
  <option>$tabmois[11]</option>
</select>
<select size='1' name='annee1'>
  <option value=''>$lx_yr";
for ($i=PREMIERE_ANNEE;$i<=date('Y');$i++) 
{
    echo "<option>$i";
}
echo "
</select>
<input type='hidden' name='period' value='r_mensuel'>
";
echo "<input type='submit' value='Go'></form>";
if ($vide==0) 
{
	echo "<Font size='5'><b>$titre</b></Font>";
}
 
if ($vide==1) {exit;}

$spaces = array("     ","    ","   ","  ");
$space = array(" "," "," "," ");

//include ('GetMonthlyData1.php');
include ('LectMensNOAA1.inc.php');

##############################################
# Récupération des moyennes et maxi mensuels #
##############################################
for ($index=1; $index<2; $index++) 
{
################################################################
# Récupératuration lecture des fichiers xml de GW
################################################################
#Récupération des jours de soleil

	$fichier = REP_GW.$annee[$index]."/".$moisch[$index]."/".$annee[$index]."_".$moisch[$index]."_".$jourch[$index].".xml";
	if (file_exists($fichier) && SONDE_SOL=="TRUE") 
	{
		$fp = fopen ("$fichier","r");
		$content = fread ($fp,filesize("$fichier"));
		fclose ($fp);
		$valeur = strstr($content,"<nb-hours-of-sunshine");
		$soleil[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,22,14));
	}
	/*else le fichier n'existe pas
	{
		$soleil[$index]="";
	}*/
#Récupération de l'$lx_sunny total
	
	$fiche = REP_GW.$annee[$index]."/".$moisch[$index]."/".$annee[$index]."_".$moisch[$index].".xml";
	if (file_exists($fiche) && SONDE_SOL=="TRUE") 
	{
		$fp = fopen ("$fiche","r");
		$content = fread ($fp,filesize("$fiche"));
		fclose ($fp);
		$valeur = strstr($content,"<nb-hours-of-sunshine");
		$soleil_m[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,22,12));
		$valeur = strstr($content,"<total-solar-energy");
		$soleilnrj[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,20,14));
		$valeur = strstr($content,"<solar_radiation");
		$valeur = strstr($valeur,"mean");
		$soleilrad[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,5,10));
	//UV index
	}
	else 
	{
		$soleil_m[$index]=""; $soleilrad[$index]=""; $soleilnrj[$index]="";
		//UV index
	}
//}

################################################################
# Récupératuration des autres maxi/mini et calcul des moyennes #
################################################################
//for ($index=1; $index<2; $index++) 
//{

	for ($i=0; $i<$nb[$index]+1; $i++) 
	{
		$soleiltotal[$index]=0;
		//$value = explode(" ",$line[$index][$i]);
		//$jourch[$index] = substr((100+$value[1]),1);

		$fichier = REP_GW.$annee[$index]."/".$moisch[$index]."/".$annee[$index]."_".$moisch[$index]."_".$jourch[$index].".xml";
		if (file_exists($fichier) && SONDE_SOL=="TRUE") 
		{
			$fp = fopen ("$fichier","r");
			$content = fread ($fp,filesize("$fichier"));
			fclose ($fp);
			$valeur = strstr($content,"<nb-hours-of-sunshine");
			$soleil[$index] = mb_ereg_replace ("[^0-9\.]","",substr ($valeur,22,14));

		/*else 
		{
		$soleil[$index]="";
		}*/

		if ($soleil[$index] > $maxsoleil[$index] && $soleil[$index]!="") 
		{
			$maxsoleil[$index]=$soleil[$index]; 
			$jourmaxsoleil[$index]=$i+1;
		}

		if ($soleil[$index]!="") 
		{
			$soleiltotal[$index] = $soleiltotal[$index]+$soleil[$index];
			$soleil_moy[$index] = round(($soleiltotal[$index]/$jourch[$index]), 1);
		}
		}
	}
}

###################
# Affichage Final #
###################




echo "<Table class='rap1'  border=1><TR><td width=900>";
include "rapport_m1.php";



echo '</td>';
$xtitre=$lexday;
$Xlab=$xlabel;
$mensuel=true;
$monstep='2';
include "traceH1.php";

for ($index=1; $index<2; $index++) 
{
echo "</TD></tr><tr><td>
<br>
<Table border=1 width=900>
  <TR bgcolor='#aaaaaa'>
    <TD width=443>
	<UL>
	<LI><B>$lx_temp</B>
		<UL class='rap2' >
		<LI>$lx_temp_avg_mth : <span class='stylegrosrouge'>$meantemp_m[$index] °C</span>
		<LI>$lx_temp_avg_min: <span class='stylegrosrouge'>$meantemp_min[$index] °C</span>
		<LI>$lx_temp_avg_max: <span class='stylegrosrouge'>$meantemp_max[$index] °C</span>
		<LI>$lx_tn_mth : <span class='stylegrosrouge'>$lowtemp_m[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jourlowtemp_m[$index]</span>
		<LI>$lx_tx_mth : <span class='stylegrosrouge'>$hightemp_m[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jourhightemp_m[$index]</span>
		<LI>$lx_amp_min : <span class='stylegrosrouge'>$amplitude_min[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jour_amplitude_min[$index]</span>
		<LI>$lx_amp_max : <span class='stylegrosrouge'>$amplitude_max[$index] °C</span>$lx_on<span class='stylegrosrouge'>$jour_amplitude_max[$index]</span><BR>
		</UL>
	</UL>
	<UL>
	<LI><B>$lx_wind</B>
		<UL class='rap2' >
		<LI>$lx_wind_avg_mth :<BR>&nbsp&nbsp&nbsp<span class='stylegrosrouge'>$ventmoyen_m[$index] km/h</span> $lx_wind_sect <span class='stylegrosrouge'>$domdir_m[$index] </span>
		<LI>$lx_wind_max : <span class='stylegrosrouge'>$maxvent[$index] km/h</span>$lx_on<span class='stylegrosrouge'>$jour_vent_max[$index]</span>
		<LI>$lx_raf_max : <span class='stylegrosrouge'>$rafales_m[$index] km/h</span>$lx_on<span class='stylegrosrouge'>$jour_rafales_m[$index]</span>
		<LI>$lx_windy_days ($lx_raf>36 km/h) : <span class='stylegrosrouge'>$venteux[$index]</span>";
		if (MISTRAL=="TRUE"){echo "<LI>$lx_mistral_days ($lx_raf>50 km/h) : <span class='stylegrosrouge'>$venteux_mistral[$index]</span>";}
		echo "</UL>
	</UL>
	</td><td width=443>
	<UL>
	<LI><B>$lx_rain</B>
		<UL class='rap2' >
		<LI>$lx_rain_mth : <span class='stylegrosrouge'>$rain_m[$index] mm</span>
		<LI>$lx_rain_day_max <span class='stylegrosrouge'>$maxrain[$index] mm</span>$lx_on<span class='stylegrosrouge'>$jourmaxrain[$index]</span>
		</UL>
	</UL>
	<UL>";
	if (SONDE_SOL=="TRUE") 
	{
		echo "
		<LI><B>$lx_sunny</B>
		<UL class='rap2' >
		<LI>$lx_nrj_mth <span class='stylegrosrouge'>$soleilnrj[$index] kWh</span>
		<LI>$lx_rad_day_avg <span class='stylegrosrouge'>$soleilrad[$index] W/m²</span>
		<LI>$lx_sunny_mth <span class='stylegrosrouge'>$soleil_m[$index] h</span> ($lx_watt_m2)
		<LI>$lx_sun_day_max <span class='stylegrosrouge'>$maxsoleil[$index] h</span>$lx_on<span class='stylegrosrouge'>$jourmaxsoleil[$index]</span>
		</UL>
		</UL>";
	}
	echo "
    </td>
  </tr>
</table>
<br>

<table class='rap2'  border=1 width=900>
  <tr bgcolor='#aaaaaa' rawspan='2'>
    <td colspan='2'>
	<span class='stylegros'><center>$lx_days_nr $moisA[$index] $annee[$index]</center></span>
    </td>
  </tr>
  <tr bgcolor='#cccccc'>
    <td width=442 align='center'>
	<table border='0'>
	<tr><td>$lx_day_freeze_nb :</td><td><span class='stylegrosrouge'>$gel[$index]</span></td></tr>
	<tr><td>$lx_day_deep_freeze_nb (<=-5) :</td><td><span class='stylegrosrouge'>$fortgel[$index]</span></td></tr>
	<tr><td>$lx_day_icy_nb :</td><td><span class='stylegrosrouge'>$sansdegel[$index]</span></td></tr>
	<tr><td>$lx_day_hot (>=30) :</td><td><span class='stylegrosrouge'>$chaleur[$index]</span></td></tr>
	<tr><td>$lx_day_heatwave (>=35) :</td><td><span class='stylegrosrouge'>$canicule[$index]</span></td></tr>
	</table>
    </td><td align='center' valign='middle'>
	<table border='0'>
	<tr><td>$lx_rainy_day :</td><td><span class='stylegrosrouge'>$pluie[$index]</span></td></tr>
	<tr><td>$lx_rain_1to5 :</td><td><span class='stylegrosrouge'>$pluie_1[$index]</span></td></tr>
	<tr><td>$lx_rain_5to10 :</td><td><span class='stylegrosrouge'>$pluie_5[$index]</span></td></tr>
	<tr><td>$lx_rain_over10 :</td><td><span class='stylegrosrouge'>$pluie_10[$index]</span></td></tr>
	</table>
    </td>
  </tr>
</table>
</TD>";
}
echo "</TR></Table>";
?>
</HEAD>
By
Pascal
Station VP2Plus, Windows 10 64 bits,WeatherLink 6.0.5, VP2SQL, Graphiques Dynamiques à partir d'une BDD MySQL
Météo Conflans-en-Jarnisy
Image

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Re: Problem with comparasion.php

Message par Brett001 » 06 déc. 2014, 16:46

Hi Pascal!

Thanks for help, but not working with your code. :(

Possibly problem - which I consider to be possible - that is the date format difference. In Hungary is YYYYmmdd format, Suisse, France is ddmmYYYY. :?: :idea:
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Re: Problem with comparasion.php

Message par Brett001 » 10 déc. 2014, 16:23

Anybody, any idea? :?:
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Avatar du membre
jturlier
Administrateur du site
Messages : 393
Enregistré le : 10 déc. 2014, 10:20
Localisation : Sérignan 34410
Contact :

Re: Problem with comparasion.php

Message par jturlier » 11 déc. 2014, 08:19

Hi Zoltan,
in the constantes.inc.php, you indicates starting december 11 and today we are the 11th !
So i do not think you will be able to show something except screw up the application by trying to get values outside of indexes.... not good at all !

For info, you should comment the "Mistra"l line : Mistral is a north wind specific to the south of France.

RGDS

Jean
Jean

Station :
VP2pro + anémomètre ultrasons et console Vue
Cumulus 1.9.4 + Cumulus2SQL + MySQL

Audio :
FR
PC :
W10 64bits migré
http://meteoserignan.ddns.net
Image

Brett001
Messages : 7
Enregistré le : 05 déc. 2014, 15:40
Localisation : Hongrie

Re: Problem with comparasion.php

Message par Brett001 » 11 déc. 2014, 13:13

Hi Jean!

Thnx You were trying to help. I fixed mistral TRUE to FALSE, but not good. :( Something else is the problem. This is "X-files" :mrgreen:
Davis Vantage Pro2 + WeatherLink 6.0.3 + Weather Display 10.37R b81 + WDmySQL 10.7 + Windows 7/64 bit

Répondre