From ecfc8ee7e8938faf797c52ab811c12954e0d8fdd Mon Sep 17 00:00:00 2001 From: Brian Flowers Date: Tue, 27 Sep 2016 01:41:58 -0400 Subject: [PATCH] Additional adjustments to configuration saving --- configure.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/configure.php b/configure.php index 584c787..6b85a43 100755 --- a/configure.php +++ b/configure.php @@ -25,26 +25,30 @@ if( isset($_POST) ) $attribute = $id[1]; $setting = $id[2]; $value = $_POST[$key]; + if($value == "on") + $value = 1; - - $params = array(':host' => $host, + if( $attribute != "" ) + { + $params = array(':host' => $host, ':attribute' => $attribute, ':setting' => $setting, ':value' => $value); - $insert = "INSERT INTO bdsmweb(host, attribute) ". + $insert = "INSERT INTO bdsmweb(host, attribute) ". "VALUES (:host, :attribute);"; - $stmt = $db->prepare($insert); + $stmt = $db->prepare($insert); - if( $stmt ) - $stmt->execute($params); + if( $stmt ) + $stmt->execute($params); - $update = "UPDATE bdsmweb SET :setting = :value ". - "WHERE host = :host AND attribute = :attribute;"; - $stmt = $db->prepare($update); + $update = "UPDATE bdsmweb SET :setting=:value ". + "WHERE host=:host AND attribute=:attribute;"; + $stmt = $db->prepare($update); - if( $stmt ) - $stmt->execute($params); + if( $stmt ) + $stmt->execute($params); + } } } ?> -- 1.8.3.1