query("DROP VIEW " . idf_escape($_GET["createv"])) && $_POST["drop"]) { redirect(substr($SELF, 0, -1), lang('View has been dropped.')); } if (!$_POST["drop"] && $mysql->query("CREATE VIEW " . idf_escape($_POST["name"]) . " AS " . $_POST["select"])) { redirect($SELF . "view=" . urlencode($_POST["name"]), (strlen($_GET["createv"]) ? lang('View has been altered.') : lang('View has been created.'))); } $error = $mysql->error; } page_header(strlen($_GET["createv"]) ? lang('Alter view') . ": " . htmlspecialchars($_GET["createv"]) : lang('Create view')); if ($_POST) { $row = $_POST; echo "
" . lang('Unable to operate view') . ": " . htmlspecialchars($error) . "
\n"; } elseif (strlen($_GET["createv"])) { $row = array("name" => $_GET["createv"], "select" => preg_replace('~^.* AS ~U', '', $mysql->result($mysql->query("SHOW CREATE VIEW " . idf_escape($_GET["createv"])), 1))); } else { $row = array(); } ?>