$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);
+ }
}
}
?>