$b) {
if (!is_numeric($_POST[$b])) { $errors .= "$b is a numeric field. Please enter numbers only. Please go back and try again.
"; }
}
foreach($_POST as $a => $b) {
if (trim($_POST[$a]) == "" && !in_array($a,$norequires)) { $errors .= "$a is a required field. Please enter a value. Please go back and try again.
"; }
}
if ($errors != "") { err($errors); }
// Check toggles.
foreach($toggles as $a => $b) {
if (!isset($_POST[$b])) { $_POST[$b] = "0"; }
}
// Build query.
$query = "";
$columns = dorow(doquery("SHOW COLUMNS FROM {{table}}", "control"));
foreach($columns as $a => $b) {
if (isset($_POST[$b["Field"]])) { $query .= $b["Field"] . "='" . $_POST[$b["Field"]] . "',"; }
}
$query = rtrim($query, ",");
// Save settings & finish.
doquery("UPDATE {{table}} SET $query WHERE id='1' LIMIT 1", "control");
display("Main Settings", "The main settings were saved successfully.
You may return Home or to the Main Settings page.");
}
extract($controlrow);
// Checkboxes.
if ($gameopen == 1) { $controlrow["check_gameopen"] = "checked=\"checked\""; } else { $controlrow["check_gameopen"] = ""; }
if ($showshout == 1) { $controlrow["check_showshout"] = "checked=\"checked\""; } else { $controlrow["check_showshout"] = ""; }
if ($showonline == 1) { $controlrow["check_showonline"] = "checked=\"checked\""; } else { $controlrow["check_showonline"] = ""; }
if ($showmonsterimages == 1) { $controlrow["check_showmonsterimages"] = "checked=\"checked\""; } else { $controlrow["check_showmonsterimages"] = ""; }
if ($verifyemail == 1) { $controlrow["check_verifyemail"] = "checked=\"checked\""; } else { $controlrow["check_verifyemail"] = ""; }
if ($compression == 1) { $controlrow["check_compression"] = "checked=\"checked\""; } else { $controlrow["check_compression"] = ""; }
if ($debug == 1) { $controlrow["check_debug"] = "checked=\"checked\""; } else { $controlrow["check_debug"] = ""; }
// Item image dropdown.
$itemimages = array(0=>"Off",1=>"Slot",2=>"ID");
$controlrow["select_showitemimages"] = "";
foreach($itemimages as $a => $b) {
if ($controlrow["showitemimages"] == $a) { $selected = "selected=\"selected=\""; } else { $selected = ""; }
$controlrow["select_showitemimages"] .= "";
}
$page = parsetemplate(gettemplate("control"), $controlrow);
display("Main Settings", $page);
}
?>