From: Brian Flowers Date: Sun, 25 Sep 2016 17:29:52 +0000 (-0400) Subject: Additional tests for configuration X-Git-Url: http://git.slightlycyberpunk.com%2C%20git.slightlycyberpunk.com/git/?a=commitdiff_plain;h=3b1308a6bdadc85aa1e1b4ab37a720d84f8def70;p=bdsm-web.git Additional tests for configuration --- diff --git a/configure.php b/configure.php index 981b4e9..562183c 100755 --- a/configure.php +++ b/configure.php @@ -1,5 +1,44 @@ query("SELECT * FROM bdsmweb"); +if( $db->errorInfo()[0] == "HY000" ) +{ + $query = "CREATE TABLE bdsmweb (host VARCHAR(128) primary key,". + "attribute VARCHAR(128), name VARCHAR(128), ". + "graph integer, maximum integer, minimim integer, ". + "duration integer);"; + $db->query($query); + + $result = $db->query("SELECT * FROM bdsmweb;"); +} + +if( isset($_POST) ) +{ + foreach( array_keys($_POST) as $key ) + { + $id = explode("|", $key); + $host = $id[0]; + $attribute = $id[1]; + $setting = $id[2]; + $value = $_POST[$key]; + + $query = "INSERT INTO bdsmweb(host, attribute, $setting) ". + "VALUES (:host, :attribute, :value);"; + $stmt = $db->prepare($query); + + if( !$stmt ) + { + print_r($db->errorInfo()); + } + + $stmt->bindParam(':host', $host); + $stmt->bindParam(':attribute', $attribute); + $stmt->bindParam(':value', $value); + + $stmt->execute(); + } +} ?> @@ -13,7 +52,7 @@ height: 100%; width: 15%; background: linear-gradient(to right, #000 0%,#222 80%,#555 100%); - padding-top:5em; + padding-top:2em; } #vmenu a @@ -24,7 +63,7 @@ text-decoration: none; width: 100%; text-align: center; - border-top: 1px solid white; + border-bottom: 1px solid white; padding: .5em .2em; font-size: larger; } @@ -53,16 +92,19 @@ { padding-top: 2em; } + + #logo + { + width: 100%; + } -
- + Index Historical Configuration -
@@ -73,12 +115,12 @@ query("SELECT DISTINCT host FROM MEASUREMENTS"); +$result = $db->query("SELECT DISTINCT host FROM MEASUREMENTS"); +print_r($db->errorInfo()); $hosts = Array(); -while($host = $result->fetchArray(SQLITE3_ASSOC)) - if ( $host['host'] ) +while( $host = $result->fetch() ) + if( $host['host'] != "" ) array_push($hosts, $host['host']); foreach ($hosts as $host) @@ -86,9 +128,9 @@ foreach ($hosts as $host) echo ""; echo " "; echo ""; - $result = $db_handle->query("SELECT DISTINCT attribute FROM MEASUREMENTS WHERE host='$host'"); + $result = $db->query("SELECT DISTINCT attribute FROM MEASUREMENTS WHERE host='$host'"); $attributes = Array(); - while($attribute = $result->fetchArray(SQLITE3_ASSOC)) + while($attribute = $result->fetch()) if ( $attribute['attribute'] ) array_push($attributes, $attribute['attribute']); @@ -98,8 +140,8 @@ foreach ($hosts as $host) echo " "; echo " "; echo " "; - echo " "; + echo " "; echo " "; echo " "; }
Graph Duration (seconds)
$host
$attribute - ". - " - ". + "