1
0

a lot of debug

This commit is contained in:
2022-04-23 02:00:52 +02:00
parent f8fc3f63ec
commit d1f1065e44
21 changed files with 544 additions and 217 deletions

View File

@ -2,14 +2,19 @@
/****************************************************************/
/* */
/*need device ieeeAddress, property, startDate and finalDate */
/*need device ieeeAddress, property, startDate and endDate */
/* */
/****************************************************************/
function displayStats($socket, $argList)
require_once "config.php";
require_once "utils.php";
require_once "header.php";
function displayStats($ieeeAddress, $fn, $property, $startDate, $endDate)
{
global $indexFriendlyNames, $mohaDB;
logger(INFO, "Function displayStats", __FILE__ . ":" . __LINE__);
//logger(INFO, "Function displayStats", __FILE__ . ":" . __LINE__);
// Validation of the dates
if (validateDate($argList["startDate"]) && validateDate($argList["finalDate"]))
@ -23,10 +28,10 @@ function displayStats($socket, $argList)
}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";
logger(DEBUG, _("query : ") . $query, __FILE__ . ":" . __LINE__);
//logger(DEBUG, _("query : ") . $query, __FILE__ . ":" . __LINE__);
if(!($mohaDB->result = $mohaDB->query($query)))
{
logger(ERROR, _("mysql query error: ") . $mohaDB->error, __FILE__ . ":" . __LINE__);
//logger(ERROR, _("mysql query error: ") . $mohaDB->error, __FILE__ . ":" . __LINE__);
}
$datas = $mohaDB->result->fetch_all(MYSQLI_ASSOC);
htmlSend($socket, diagramDisplay($datas));
@ -144,4 +149,9 @@ function diagramDisplay($datas)
//Desallouer la mémoire utiliser par l'image
imagedestroy($courbe);
}
$tmp = explode("|", $_GET["device"]);
displayStats($tmp[0], $tmp[1], $tmp[2]);
?>