Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_SESSION["idUser"])) {
- ?>
- <h1 style="color:rgba(53,149,225,1);">Overview</h1><hr>
- <small style="color:crimson;">Only monitors which are not blocked are displayed here.</small><br><small style="color:crimson;">Average, minimum and maximum values are figured out of the database on archiv server</small><br>
- <?php
- if(isset($_SESSION["isAdmin"]) && $_SESSION["isAdmin"] == 1){
- $res = $db->query("SELECT idMonitor, dtIP, dtMonitor FROM tblMonitor ORDER BY idMonitor");
- }else{
- $res = $db->query("SELECT idMonitor, dtIP, dtMonitor FROM tblMonitor WHERE dtIsBlocked = 0 ORDER BY idMonitor");
- }
- while($arr = $res->fetch_assoc()){
- $idMonitor = functions::sanitize_string_for_html($arr["idMonitor"], $db, 0);
- $resMonitor = $db->query("SELECT COUNT(dtValue) AS NUMROWS, AVG( dtValue ) AS AVG , MAX( dtValue ) AS MAX , MIN( dtValue ) AS MIN FROM tblSensorValue WHERE fiHost=$idMonitor");
- $arrMonitor = $resMonitor->fetch_assoc();
- $avg = functions::sanitize_string_for_html(round($arrMonitor["AVG"],2), $db, 0);
- $max = functions::sanitize_string_for_html($arrMonitor["MAX"], $db, 0);
- $min = functions::sanitize_string_for_html($arrMonitor["MIN"], $db, 0);
- $numofrows = functions::sanitize_string_for_html($arrMonitor["NUMROWS"], $db, 0);
- $dtIP = functions::sanitize_string_for_html($arr["dtIP"], $db, 0);
- $dtMonitor = functions::sanitize_string_for_html($arr["dtMonitor"], $db, 0);
- echo "
- <div class='jumbotron' style='background-color:rgba(200,200,200,0.1);width: 49%;display: inline-block;padding:10px;margin-bottom:5px;'>
- <h2 style='margin-top:0px;color:rgba(53,149,225,1);'><a href='http://$dtIp'>".$dtMonitor."</a></h2><hr>
- <a href='index.php?page=sensorManagement'><p style='font-size:18px;'>ID: ". $idMonitor."</a><br>
- <a href='index.php?page=sensorManagement'>Monitorname: ". $dtMonitor."</a><br>
- <a href='index.php?page=mainTable&monitor=$idMonitor'>Number of stored values: ". $numofrows."</a><br>
- <a href='http://$dtIp'>IP-Address: ". $dtIP."</a><br>
- <a href='index.php?page=mainTable&monitor=$idMonitor'>Average: ". $avg." °C</a><br>
- <a href='index.php?page=mainTable&monitor=$idMonitor'>Maximum: ". $max." °C</a><br>
- <a href='index.php?page=mainTable&monitor=$idMonitor'>Minimum: ". $min." °C</a></p>
- </div>";
- }
- ?>
- <hr>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement