1
0

Debug serveur stats\nDebug

This commit is contained in:
daniel Tartavel 2022-05-05 21:28:26 +02:00
parent d1f1065e44
commit 68fb0579ce
11 changed files with 159 additions and 124 deletions

View File

@ -5,7 +5,7 @@ function apiDashboard($socket, $n="Général")
{ {
global $dashboards, $indexDevices; global $dashboards, $indexDevices;
require_once "apiserver/javascript.php"; require_once "apiserver/javascript.php";
logger(INFO, _("apiDashboard function"), __FILE__ . ":" . __LINE__); logger(DEBUG, _("apiDashboard function"), __FILE__ . ":" . __LINE__);
$response = insertJavascript(); $response = insertJavascript();
if(array_key_exists($n, $dashboards)) if(array_key_exists($n, $dashboards))
@ -69,7 +69,7 @@ function apiDashboard($socket, $n="Général")
function displayChoice($device, $propertyName, $value) function displayChoice($device, $propertyName, $value)
{ {
logger(INFO, _("function displayChoice"), __FILE__ . ":" . __LINE__); logger(DEBUG, _("function displayChoice"), __FILE__ . ":" . __LINE__);
$propertyObject = $device->properties[$propertyName]; $propertyObject = $device->properties[$propertyName];
$unit = ''; $unit = '';
@ -130,7 +130,7 @@ function displayChoice($device, $propertyName, $value)
function mkHTML($device, $propertyName, $choice) function mkHTML($device, $propertyName, $choice)
{ {
$html = ""; $html = "";
logger(INFO, "function mkHTML", __FILE__ . ":" . __LINE__); logger(DEBUG, "function mkHTML", __FILE__ . ":" . __LINE__);
foreach ($choice as $key => $value) foreach ($choice as $key => $value)
{ {
$html .= '<input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyName . "/" . strtolower($value) . '" value="' . $value . "\" onmouseup=\"setPropertyValue('" . $device->topic . "', '" . $device->friendlyName . "', '" . $value . "', '" . $propertyName . "')\">"; $html .= '<input type="button" id="' . $device->topic ."/" . $device->friendlyName . "/" . $propertyName . "/" . strtolower($value) . '" value="' . $value . "\" onmouseup=\"setPropertyValue('" . $device->topic . "', '" . $device->friendlyName . "', '" . $value . "', '" . $propertyName . "')\">";
@ -402,7 +402,7 @@ function apiNotify($argList)
function apiVerbose($argList) function apiVerbose($argList)
{ {
global $logLevel, $logLevels; global $logLevel, $logLevels;
logger(INFO, _("apiVerbose function"), __FILE__ . ":" . __LINE__); logger(DEBUG, _("apiVerbose function"), __FILE__ . ":" . __LINE__);
$response = ""; $response = "";
//print_r($argList); //print_r($argList);
foreach ($logLevels as $value => $level) foreach ($logLevels as $value => $level)
@ -430,7 +430,6 @@ function getFn($argList)
$jsonArray = array(); $jsonArray = array();
logger(INFO, _("getFn function"), __FILE__ . ":" . __LINE__); logger(INFO, _("getFn function"), __FILE__ . ":" . __LINE__);
if (array_key_exists("ieeeAddress", $argList)) if (array_key_exists("ieeeAddress", $argList))
{ {
logger(DEBUG, "ieeeAddress = " . $argList["ieeeAddress"], __FILE__ . ":" . __LINE__); logger(DEBUG, "ieeeAddress = " . $argList["ieeeAddress"], __FILE__ . ":" . __LINE__);

View File

@ -27,7 +27,7 @@ class db extends mysqli
{ {
logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__); logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__);
} }
$result = new mysqli_result($this); $this->result = new mysqli_result($this);
} }
function protect($string) function protect($string)
@ -47,7 +47,7 @@ class db extends mysqli
$ieeeAddress = $device->ieeeAddress; $ieeeAddress = $device->ieeeAddress;
//print_r($ieeeAddress); //print_r($ieeeAddress);
$query = "INSERT INTO logs (device, property, value) VALUES('" . $this->protect($ieeeAddress) . "', '" . $this->protect($property) . "', '" . $this->protect(bool2string($value)) . "')"; $query = "INSERT INTO logs (device, property, value) VALUES('" . $this->protect($ieeeAddress) . "', '" . $this->protect($property) . "', '" . $this->protect(bool2string($value)) . "')";
echo $query . EOL; //echo $query . EOL;
if (is_numeric($value) and !empty($properties2log[$property])) if (is_numeric($value) and !empty($properties2log[$property]))
{ {
// calculate a min/max value for storing data // calculate a min/max value for storing data
@ -66,7 +66,7 @@ class db extends mysqli
if ($value >= $oldValue - $minMax and $value <= $oldValue + $minMax) if ($value >= $oldValue - $minMax and $value <= $oldValue + $minMax)
{ {
//echo "========>>>>>>>>>not changed" . EOL; //echo "========>>>>>>>>>not changed" . EOL;
return 0; return true;
} }
} }
if ($testMode) if ($testMode)

View File

@ -181,7 +181,7 @@ function setDelay(device &$deviceObject, float $delay, string $unit, string $pro
$logLevel = $oldLevel; $logLevel = $oldLevel;
} }
function removeEvent(device $deviceObject, string $property , $value, int $method = null) function removeEvent(device $deviceObject, string $property , $value, int $method = IDLE)
{ {
global $events; global $events;
$eventKey = searchEvent($deviceObject, $property , $value); $eventKey = searchEvent($deviceObject, $property , $value);

View File

@ -46,14 +46,14 @@ class rdc_sdb_eclairage extends hook
logger(DEBUG, _("CASE: state_l1"), __FILE__ . ":" . __LINE__); logger(DEBUG, _("CASE: state_l1"), __FILE__ . ":" . __LINE__);
if ($value == "ON") if ($value == "ON")
{ {
if ($deviceTarget->properties["state_l1"]["method"] != MANUAL) if ($deviceTarget->properties["state_l1"]["method"] != AUTO)
{
$delay = $this->delay;
$deviceTarget->properties["state_l1"]["method"] = AUTO;
}else
{ {
$delay = $this->delayManual; $delay = $this->delayManual;
$deviceTarget->properties["state_l1"]["method"] = MANUAL; $deviceTarget->properties["state_l1"]["method"] = MANUAL;
}else
{
$delay = $this->delay;
$deviceTarget->properties["state_l1"]["method"] = MANUAL;
} }
setDelay($deviceTarget, $delay, $this->timeUnit, "state_l1", "OFF", true, IDLE); setDelay($deviceTarget, $delay, $this->timeUnit, "state_l1", "OFF", true, IDLE);
}elseif ($value == "OFF") }elseif ($value == "OFF")

View File

@ -31,6 +31,7 @@ class rdc_store extends hook
logger(DEBUG, "Callback : RDC_STORE", __FILE__ . ":" . __LINE__); logger(DEBUG, "Callback : RDC_STORE", __FILE__ . ":" . __LINE__);
$rain = 0; $rain = 0;
static $rainS;
$exterieur_lux = 0; $exterieur_lux = 0;
$salon_lux = 0; $salon_lux = 0;
$rafale = 0; $rafale = 0;
@ -70,7 +71,9 @@ class rdc_store extends hook
{ {
if (array_key_exists("rainin", $indexDevices[METEO]->properties)) if (array_key_exists("rainin", $indexDevices[METEO]->properties))
{ {
$rain = $indexDevices[METEO]->properties["rainin"]["value"]; $rainTmp = $indexDevices[METEO]->properties["rainin"]["value"];
$rain = $rainTmp - $rainS;
$rainS = $rainTmp;
logger(DEBUG, "rain=" . var_dump($rain), __FILE__ . ":" . __LINE__); logger(DEBUG, "rain=" . var_dump($rain), __FILE__ . ":" . __LINE__);
} }
if (array_key_exists("windgustkmh", $indexDevices[METEO]->properties)) if (array_key_exists("windgustkmh", $indexDevices[METEO]->properties))
@ -123,7 +126,7 @@ class rdc_store extends hook
$this->set($store2level); $this->set($store2level);
} }
} }
}elseif ($exterieur_lux < 15000 and $salon_lux < 300) }elseif ($exterieur_lux < 15000 and $salon_lux < 110)
{ {
logger(DEBUG, "exterieur_lux < 15000", __FILE__ . ":" . __LINE__); logger(DEBUG, "exterieur_lux < 15000", __FILE__ . ":" . __LINE__);
$this->close("Luminosité faible"); $this->close("Luminosité faible");

View File

@ -1,6 +1,55 @@
<?php <?php
////logger(DEBUG, _("Including utils.php"), __FILE__ . ":" . __LINE__); ////logger(DEBUG, _("Including utils.php"), __FILE__ . ":" . __LINE__);
/*function logger($level, $log, $pos = "")
{
global $logFh, $logLevel, $notificationLevel, $logLevels;
$logString = $logLevels[$level] . " " ;
if ($pos !== false)
{
$logString .= $pos;
}
$logString .= " - " . $log;
if ($level & $logLevel)
{
fwrite($logFh, date("c") . ' ' . $logString . EOL);
print ("MOHA-" . $logString . EOL);
}
}*/
function htmlGetFriendlyNames($ieeeAddress = '')
{
$url = "HTTP://localhost:1025/friendlyname";
$ch = curl_init($url);
if ($ieeeAddress !== '')
{
$url .= "&ieeeAddress=" . $ieeeAddress;
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$fn = curl_exec($ch);
curl_close($ch);
if (($start = strpos($fn, "{")) === false)
{
if (($start = strpos($fn, "[")) === false)
{
print "Erreur : fn = " . $fn . __FILE__ . ":" . __LINE__ . EOLH;
return false;
}else
{
$end = strpos($fn, "]");
}
}else
{
$end = strpos($fn, "}");
}
$length = $end - $start + 1;
$fn = substr($fn, $start, $length);
return jsonDecode($fn);
}
function bool2string($var) function bool2string($var)
{ {
if ($var === false) if ($var === false)
@ -18,7 +67,22 @@ function bool2string($var)
} }
} }
function validateDate($date, $format = 'Y-m-d H:i:s') function jsonDecode($json)
{
//print "==========>" . print_r($json, true) . EOLH;
$jsonArray = array();
$json = trim($json, " {[]}");
$tmp = explode(",", $json);
foreach($tmp as $value)
{
$tmp2 = explode (":" , $value);
$jsonArray[trim($tmp2[0], '"')] = trim($tmp2[1], '"');
}
return $jsonArray;
}
function validateDate($date, $format = 'Y-m-d')
{ {
$d = DateTime::createFromFormat($format, $date); $d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date; return $d && $d->format($format) == $date;

View File

@ -19,15 +19,15 @@ class db extends mysqli
} }
while ($this->connect($this->mysqlServer, $this->username, $this->passwd, $this->database) === false) while ($this->connect($this->mysqlServer, $this->username, $this->passwd, $this->database) === false)
{ {
//logger(ERROR,_("Connection to sql server error :") . $this->connect_error, __FILE__ . ":" . __LINE__); logger(ERROR,_("Connection to sql server error :") . $this->connect_error, __FILE__ . ":" . __LINE__);
sleep(5); sleep(5);
$flagError = true; $flagError = true;
} }
if ($flagError === true) if ($flagError === true)
{ {
//logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__); logger(ERROR, _("Connection to sql server ready"), __FILE__ . ":" . __LINE__);
} }
$result = new mysqli_result($this); $this->result = new mysqli_result($this);
} }
function protect($string) function protect($string)
@ -35,4 +35,6 @@ class db extends mysqli
return $this->real_escape_string($string); return $this->real_escape_string($string);
} }
} }
$mohaDB = new db();
?> ?>

View File

@ -2,4 +2,14 @@
$varPath = "/usr/share/moha/"; $varPath = "/usr/share/moha/";
$mohaPath = "/home/daniel/moha"; $mohaPath = "/home/daniel/moha";
$configPath = "/etc/moha/"; $configPath = "/etc/moha/";
function logger($level, $log, $pos = "")
{
global $logLevel;
if ($level & $logLevel)
{
print ("MOHA-" . $level . $log .$pos . EOL);
}
}
?> ?>

View File

@ -5,42 +5,52 @@
/*need device ieeeAddress, property, startDate and endDate */ /*need device ieeeAddress, property, startDate and endDate */
/* */ /* */
/****************************************************************/ /****************************************************************/
require_once "config.php"; require_once "config.php";
require_once "utils.php"; require_once $mohaPath . "/utils.php";
require_once "header.php"; require_once "header.php";
require_once $mohaPath . "/constants.php";
require_once "class/db.class.php";
//require_once $configPath . "properties2log.php";
$logLevel = INFO | NOTICE | WARNING | ERROR | ALERT;
function displayStats($ieeeAddress, $fn, $property, $startDate, $endDate) function displayStats($ieeeAddress, $fn, $property, $startDate, $endDate)
{ {
global $indexFriendlyNames, $mohaDB; global $mohaDB;
//logger(INFO, "Function displayStats", __FILE__ . ":" . __LINE__); //logger(INFO, "Function displayStats", __FILE__ . ":" . __LINE__);
if ( ($indexFriendlyNames = htmlGetFriendlyNames($ieeeAddress)) !== false)
{
//print_r($indexFriendlyNames);
// Validation of the dates // Validation of the dates
if (validateDate($argList["startDate"]) && validateDate($argList["finalDate"])) if (validateDate($startDate) && validateDate($endDate))
{ {
if (!array_key_exists($argList["fn"], $indexFriendlyNames)) if (!in_array($fn, $indexFriendlyNames))
{ {
htmlSend($socket, $argList["fn"] . _(" not found: Verify the syntax")); print $fn . _(" not found: Verify the syntax");
}elseif(!array_key_exists($argList["property"], $indexFriendlyNames[$argList["fn"]]->properties))
{
htmlSend($socket, $argList["property"] . _(" not found : Verify the syntax"));
}else }else
{ {
$query = "SELECT date, value FROM logs WHERE device='" . $indexFriendlyNames[$argList["fn"]]->ieeeAddress . "' AND property='" . $argList["property"] . "' AND '" . $argList["startDate"] . "'>= date AND '" . $argList["finalDate"] . "' <= date ORDER BY date"; $query = "SELECT date, value FROM logs WHERE device='" . $ieeeAddress . "' AND property='" . $property . "' AND '" . $startDate . " 00:00:00'<= date AND '" . $endDate . " 23:59:59' >= date ORDER BY date";
//logger(DEBUG, _("query : ") . $query, __FILE__ . ":" . __LINE__); logger(DEBUG, _("query : ") . $query, __FILE__ . ":" . __LINE__);
if(!($mohaDB->result = $mohaDB->query($query))) if(!($mohaDB->result = $mohaDB->query($query)))
{ {
//logger(ERROR, _("mysql query error: ") . $mohaDB->error, __FILE__ . ":" . __LINE__); print _("mysql query error: ") . $mohaDB->error . __FILE__ . ":" . __LINE__;
} }
$datas = $mohaDB->result->fetch_all(MYSQLI_ASSOC); $datas = $mohaDB->result->fetch_all(MYSQLI_ASSOC);
htmlSend($socket, diagramDisplay($datas)); //print_r($mohaDB);
if ($mohaDB->affected_rows != 0)
{
print diagramDisplay($datas);
}else
{
print _("Sorry, no results");
}
} }
}else }else
{ {
htmlSend($socket, _("Dates are not of the form: YYYY-MM-DD 00:00:00")); print _("Dates need to be of the form: YYYY-MM-DD 00:00:00");
}
} }
} }
/************************************************************/ /************************************************************/
@ -56,18 +66,17 @@ function diagramDisplay($datas)
$ndata = count($datas); $ndata = count($datas);
$i = $ndata; $i = $ndata;
$tmp = min($datas); $min = min(array_column($datas, "value"));
$min = $tmp["value"]; $max = max(array_column($datas, "value"));
$tmp = max($datas); //print "min =>" . $min . "max =>" . $max . EOLH;
$max = $tmp["value"];
//Type mime de l'image //Type mime de l'image
//Chemin vers le police à utiliser //Chemin vers le police à utiliser
$font_file = '/usr/share/fonts/TTF/dejavu/DejaVuSans.ttf'; $font_file = '/usr/share/fonts/TTF/dejavu/DejaVuSans.ttf';
//Adapter la largeur de l'image avec le nombre de donnée //Adapter la largeur de l'image avec le nombre de donnée
$largeur = $i * 50 + 90; $largeur = ($ndata + 1) * 30 + 90;
$hauteur = 400; $hauteur = 400;
//Hauteur de l'abscisse par rapport au bas de l'image //Hauteur de l'abscisse par rapport au bas de l'image
$absis = 80; $absis = 120;
//Création de l'image //Création de l'image
$courbe = imagecreatetruecolor($largeur, $hauteur); $courbe = imagecreatetruecolor($largeur, $hauteur);
//Allouer les couleurs à utiliser //Allouer les couleurs à utiliser
@ -82,7 +91,7 @@ function diagramDisplay($datas)
imageline($courbe, 50, $hauteur - $absis, $largeur - 10, $hauteur - $absis, $noir); imageline($courbe, 50, $hauteur - $absis, $largeur - 10, $hauteur - $absis, $noir);
//Tracer l'axe des ordonnées //Tracer l'axe des ordonnées
imageline($courbe, 50, $hauteur - $absis, 50, 20, $noir); imageline($courbe, 50, $hauteur - $absis, 50, 20, $noir);
//Decaler 10px vers le haut le si le minimum est différent de 0 //Decaler 10px vers le haut si le minimum est différent de 0
$a = 0; $a = 0;
if($min != 0) if($min != 0)
{ {
@ -92,17 +101,17 @@ function diagramDisplay($datas)
//Nombres des grides verticales //Nombres des grides verticales
$nbOrdonne = 10; $nbOrdonne = 10;
//Calcul de l'echelle des abscisses //Calcul de l'echelle des abscisses
$echelleX = ($largeur - 100) / $i; $echelleX = ($largeur - 130) / $ndata;
//Calcul de l'echelle des ordonnees //Calcul de l'echelle des ordonnees
$echelleY = ($hauteur - $absis - 20) / $nbOrdonne; $echelleY = ($hauteur - $absis) / ($nbOrdonne + 1);
$i = $min; $i = $min;
//Calcul des ordonnees des grides //Calcul des ordonnees des grides
$py = ($max - $min) / $nbOrdonne; $py = ($max - $min) / $nbOrdonne;
$pasY = $absis; $pasY = $absis;
while( $pasY < ($hauteur - 19)) while($i <= ($max - $min))
{ {
//Affiche la valeur de l'ordonnee //Affiche la valeur de l'ordonnee
imagestring($courbe, 2, 10 , $hauteur - $pasY - 6, round($i), $noir); imagestring($courbe, 2, 10 , $hauteur - $pasY - 6, round($i, 0, PHP_ROUND_HALF_DOWN), $noir);
//Trace la gride //Trace la gride
imageline($courbe, 50, $hauteur - $pasY, $largeur - 20, $hauteur - $pasY, $ligne); imageline($courbe, 50, $hauteur - $pasY, $largeur - 20, $hauteur - $pasY, $ligne);
//Decaller vers le haut pour la prochaine gride //Decaller vers le haut pour la prochaine gride
@ -112,22 +121,22 @@ function diagramDisplay($datas)
} }
$j = -1; $j = -1;
$pasX = 90; $pasX = 50;
//Parcourir le tableau pour le traçage de la diagramme //Parcourir le tableau pour le traçage du diagramme.
foreach ($datas as $row) foreach ($datas as $row)
{ {
$date = $row["date"]; $date = $row["date"];
$quantite = $row["value"]; $quantite = $row["value"];
//calculer la hateur du point par rapport à sa valeur //calculer la hauteur du point par rapport à sa valeur
$y = ($hauteur) - (($quantite - $min) * ($echelleY / $py)) - $absis; $y = ($hauteur) - (($quantite - $min) * ($echelleY / $py)) - $absis;
//dessiner le point //dessiner le point
imagefilledellipse($courbe, $pasX, $y, 6, 6, $rouge); imagefilledellipse($courbe, $pasX, $y, 6, 6, $rouge);
//Afficher le mois en français avec une inclinaison de 315° //Afficher le mois en français avec une inclinaison de 315°
printf("pasx = %d hauteur = %d absis = %d noir= %d", $pasX, $hauteur, $absis, $noir); //printf("pasx = %d hauteur = %d absis = %d noir= %d", $pasX, $hauteur, $absis, $noir);
imagefttext($courbe, 10, 315, $pasX, $hauteur - $absis + 20, $noir, $font_file, $date); imagefttext($courbe, 10, 315, $pasX, $hauteur - $absis + 20, $noir, $font_file, $date);
//Tacer une ligne veticale de l'axe de l'abscisse vers le point //Tracer une ligne verticale de l'axe de l'abscisse vers le point
imageline($courbe, $pasX, $hauteur - $absis + $a, $pasX, $y, $noir); imageline($courbe, $pasX, $hauteur - $absis + $a, $pasX, $y, $noir);
if($j!==-1) if($j !== -1)
{ {
//liée le point actuel avec la précédente //liée le point actuel avec la précédente
imageline($courbe, ($pasX - $echelleX), $yprev, $pasX, $y, $noir); imageline($courbe, ($pasX - $echelleX), $yprev, $pasX, $y, $noir);
@ -137,21 +146,19 @@ function diagramDisplay($datas)
$j = $quantite; $j = $quantite;
//enregister la hauteur du point actuel pour la liaison avec la suivante //enregister la hauteur du point actuel pour la liaison avec la suivante
$yprev = $y; $yprev = $y;
//Decaller l'abscisse suivante par rapport à son echelle //Decaler l'abscisse suivante par rapport à son echelle
$pasX +=$echelleX; $pasX += $echelleX;
} }
//Envoyer le flux de l'image //Envoyer le flux de l'image
$file = tempnam("./", "moha-");
//header('Content-Type: image/png');
$file = tempnam("php://temp", "moha-");
imagepng($courbe,$file); imagepng($courbe,$file);
return '<img src="/' . basename($file) . '">'; return '<img src="/moha/' . basename($file) . '">';
//Desallouer la mémoire utiliser par l'image //Désallouer la mémoire utiliser par l'image
imagedestroy($courbe); imagedestroy($courbe);
} }
$tmp = explode("|", $_GET["device"]); $tmp = explode("|", $_GET["device"]);
displayStats($tmp[0], $tmp[1], $tmp[2]); displayStats($tmp[0], $tmp[1], $tmp[2], $_GET["startDate"], $_GET["endDate"]);
?> ?>

View File

@ -1,47 +1,11 @@
<?php <?php
require_once "header.php"; require_once "header.php";
require_once "config.php"; require_once "config.php";
require_once "utils.php"; require_once $mohaPath . "/utils.php";
require_once $mohaPath . "/constants.php"; require_once $mohaPath . "/constants.php";
require_once $mohaPath . "/class/db.php"; require_once "class/db.class.php";
require_once $configPath . "properties2log.php"; require_once $configPath . "properties2log.php";
function logger($level, $log, $pos = "")
{
global $logFh, $logLevel, $notificationLevel, $logLevels;
$logString = $logLevels[$level] . " " ;
if ($pos !== false)
{
$logString .= $pos;
}
$logString .= " - " . $log;
if ($level & $logLevel)
{
fwrite($logFh, date("c") . ' ' . $logString . EOL);
print ("MOHA-" . $logString . EOL);
}
}
function htmlGetFriendlyNames($ieeeAddress = '') : array
{
$url = "HTTP://localhost:1025/friendlyname";
$ch = curl_init($url);
if ($ieeeAddress !== '')
{
$url .= "&ieeeAddress=" . $ieeeAddress;
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$fn = curl_exec($ch);
curl_close($ch);
$start = strpos($fn, "{");
$end = strpos($fn, "}");
$length = $end - $start + 1;
$fn = substr($fn, $start, $length);
return jsonDecode($fn);
}
$indexIeeeAddress = htmlGetFriendlyNames(); $indexIeeeAddress = htmlGetFriendlyNames();
//print_r($indexIeeeAddress); //print_r($indexIeeeAddress);
@ -83,7 +47,9 @@ if (empty($indexIeeeAddress))
} }
print '</optgroup>' . EOL; print '</optgroup>' . EOL;
} }
print "</select>"; print "</select>" . EOLH;
print '<input type="date" name="startDate">' . EOLH;
print '<input type="date" name="endDate">' . EOLH;
print '<input type="submit" value="Afficher les statistiques">'; print '<input type="submit" value="Afficher les statistiques">';
print "</form>" . EOL; print "</form>" . EOL;
} }

View File

@ -1,16 +0,0 @@
<?php
function jsonDecode($json)
{
$jsonArray = array();
$json = trim($json, " {[]}");
$tmp = explode(",", $json);
foreach($tmp as $value)
{
$tmp2 = explode (":" , $value);
$jsonArray[trim($tmp2[0], '"')] = trim($tmp2[1], '"');
}
return $jsonArray;
}
?>