Advertisement
showtimeiNK

Untitled

May 28th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.58 KB | None | 0 0
  1. <?php
  2. if(isset($_SESSION["idUser"])) {
  3. ?>
  4. <h1 style="color:rgba(53,149,225,1);">Overview</h1><hr>
  5.     <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>
  6.     <?php
  7.         if(isset($_SESSION["isAdmin"]) && $_SESSION["isAdmin"] == 1){
  8.             $res = $db->query("SELECT idMonitor, dtIP, dtMonitor FROM tblMonitor ORDER BY idMonitor");
  9.         }else{
  10.             $res = $db->query("SELECT idMonitor, dtIP, dtMonitor FROM tblMonitor WHERE dtIsBlocked = 0 ORDER BY idMonitor");
  11.         }
  12.          while($arr = $res->fetch_assoc()){
  13.              $idMonitor = functions::sanitize_string_for_html($arr["idMonitor"], $db, 0);
  14.              $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");
  15.              $arrMonitor = $resMonitor->fetch_assoc();
  16.             $avg = functions::sanitize_string_for_html(round($arrMonitor["AVG"],2), $db, 0);
  17.             $max = functions::sanitize_string_for_html($arrMonitor["MAX"], $db, 0);
  18.             $min = functions::sanitize_string_for_html($arrMonitor["MIN"], $db, 0);
  19.             $numofrows = functions::sanitize_string_for_html($arrMonitor["NUMROWS"], $db, 0);
  20.             $dtIP = functions::sanitize_string_for_html($arr["dtIP"], $db, 0);
  21.             $dtMonitor = functions::sanitize_string_for_html($arr["dtMonitor"], $db, 0);
  22.             echo "
  23.            <div class='jumbotron' style='background-color:rgba(200,200,200,0.1);width: 49%;display: inline-block;padding:10px;margin-bottom:5px;'>
  24.                <h2 style='margin-top:0px;color:rgba(53,149,225,1);'><a href='http://$dtIp'>".$dtMonitor."</a></h2><hr>
  25.                <a href='index.php?page=sensorManagement'><p style='font-size:18px;'>ID: ". $idMonitor."</a><br>
  26.                <a href='index.php?page=sensorManagement'>Monitorname: ". $dtMonitor."</a><br>
  27.                <a href='index.php?page=mainTable&monitor=$idMonitor'>Number of stored values: ". $numofrows."</a><br>
  28.                <a href='http://$dtIp'>IP-Address: ". $dtIP."</a><br>
  29.                <a href='index.php?page=mainTable&monitor=$idMonitor'>Average:  ". $avg." °C</a><br>
  30.                <a href='index.php?page=mainTable&monitor=$idMonitor'>Maximum:  ". $max." °C</a><br>
  31.                <a href='index.php?page=mainTable&monitor=$idMonitor'>Minimum:  ". $min." °C</a></p>
  32.             </div>";
  33.         }
  34.     ?>
  35.     <hr>
  36. <?php
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement