escapeString($_POST['name']);
$uid = $_POST['uid'];
$sql = "";
if (isset($_POST['content']) and ($type === "Section" or $type === "Component")) {
$content = $conn->escapeString($_POST['content']);
$sql = "UPDATE $type SET name='$name', content='$content' WHERE UID='$uid'";
} else if (isset($_POST['sections']) and $type === "Page") {
$css = $_POST['css'];
$sections = $_POST['sections'];
$sql = "UPDATE Page SET name='$name', sections='$sections', CSS='$css' WHERE UID='$uid'";
} else if ($type === "Menu") {
$value = $conn->escapeString($_POST['value']);
$valuetype = $_POST['type'];
$sql = "UPDATE Menu SET name='$name', valuetype='$valuetype', value='$value' WHERE UID='$uid'";
}
if ($conn->query($sql)) {
echo "";
} else {
echo "";
}
} else if (isset($_POST['css'])) {
$file = fopen("../stylesheets/StyleSheet.css", "w");
fwrite($file, $_POST['css']);
fclose($file);
}
//View building script:
if ($type !== "CSS") {
$query = $conn->query("SELECT * FROM $type WHERE UID='$uid'");
$row = $query->fetchArray();
$name = isset($row['name']) ? $row['name'] : $row['User'];
}
$inputs = array();
switch ($type) {
case "Section":
case "Component":
$content = $row['content'];
$inputs = array("