$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);
}
}
}
+
?>
<HTML>
<HEAD>
echo " <tr>";
echo " <td>$attribute</td>";
echo " <td><input type='text' name='$host|$attribute|name' value='".$values['name']."' /></td>";
- echo " <td><input type='checkbox' name='$host|$attribute|graph' ".($values['name']?"checked":"")."/></td>";
+ echo " <td><input type='checkbox' name='$host|$attribute|graph' ".($values['graph']?"checked":"")."/></td>";
echo " <td><input type='text' name='$host|$attribute|minimum' value='".$values['minimum']."' class='short'/> - ".
"<input type='text' name='$host|$attribute|maximum' value='".$values['maximum']."' class='short'/></td>";
echo " <td><input type='text' name='$host|$attribute|duration' value='".$values['duration']."' class='short' /></td>";