1
0

Debug serveur stats\nDebug

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

View File

@@ -1,47 +1,11 @@
<?php
require_once "header.php";
require_once "config.php";
require_once "utils.php";
require_once $mohaPath . "/utils.php";
require_once $mohaPath . "/constants.php";
require_once $mohaPath . "/class/db.php";
require_once "class/db.class.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();
//print_r($indexIeeeAddress);
@@ -83,7 +47,9 @@ if (empty($indexIeeeAddress))
}
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 "</form>" . EOL;
}