From b9aa166244be8fbfaf8d8161bed4e11f22b0c4aa Mon Sep 17 00:00:00 2001 From: Brian Flowers Date: Tue, 27 Sep 2016 02:55:16 -0400 Subject: [PATCH] Fixing config saving --- configure.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/configure.php b/configure.php index 4742186..0b9e66b 100755 --- a/configure.php +++ b/configure.php @@ -27,30 +27,28 @@ if( isset($_POST) ) $value = $_POST[$key]; if($value == "on") $value = 1; + if($value == "off") + $value = 0; if( $attribute != "" ) { $params = array(':host' => $host, - ':attribute' => $attribute, - ':setting' => $setting, - ':value' => $value); - + ':attribute' => $attribute); + $insert = "INSERT INTO bdsmweb(host, attribute) ". "VALUES (:host, :attribute);"; $stmt = $db->prepare($insert); + $stmt->execute($params); - if( $stmt ) - $stmt->execute($params); - - $update = "UPDATE bdsmweb SET :setting=:value ". + $params[':value'] = $value; + $update = "UPDATE bdsmweb SET $setting=:value ". "WHERE host=:host AND attribute=:attribute;"; $stmt = $db->prepare($update); - - if( $stmt ) - $stmt->execute($params); + $stmt->execute($params); } } } + ?> @@ -152,7 +150,7 @@ foreach ($hosts as $host) echo " "; echo " $attribute"; echo " "; - echo " "; + echo " "; echo " - ". ""; echo " "; -- 1.8.3.1