<?php

// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// File: superuser.php
require_once "common.php";
isnewday(2);
addcommentary();
addnav("M?Return to the Mundane", "village.php");
if (!isset($_GET['op'])) {
    $_GET['op'] = '';
}
if ($_GET['op'] == "newsdelete") {
    $sql = "DELETE FROM news WHERE newsid='{$_GET['newsid']}'";
    db_query($sql);
    $return = $_GET['return'];
    $return = preg_replace("'[?&]c=[[:digit:]-]*'", "", $return);
    $return = substr($return, strrpos($return, "/") + 1);
    redirect($return);
}
if ($_GET['op'] == "commentdelete") {
    $sql = "DELETE FROM commentary WHERE commentid='{$_GET['commentid']}'";
    db_query($sql);
    $return = $_GET['return'];
    $return = preg_replace("'[?&]c=[[:digit:]-]*'", "", $return);
    $return = substr($return, strrpos($return, "/") + 1);
    if (strpos($return, "?") === false && strpos($return, "&") !== false) {
        $x = strpos($return, "&");
<?php

// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// File: mounts.php
require_once "common.php";
isnewday(3);
page_header("Mount Editor");
addnav("G?Return to the Grotto", "superuser.php");
addnav("M?Return to the Mundane", "village.php");
addnav("Add a mount", "mounts.php?op=add");
if (!isset($_GET['op'])) {
    $_GET['op'] = '';
}
if ($_GET['op'] == "del") {
    $sql = "UPDATE mounts SET mountactive=0 WHERE mountid='{$_GET['id']}'";
    db_query($sql);
    $_GET['op'] = "";
}
if ($_GET['op'] == "undel") {
    $sql = "UPDATE mounts SET mountactive=1 WHERE mountid='{$_GET['id']}'";
    db_query($sql);
    $_GET['op'] = "";
}
if ($_GET['op'] == "") {
    $sql = "SELECT * FROM mounts ORDER BY mountcategory, mountcostgems, mountcostgold";
    output("<table>", true);
    output("<tr><td>Ops</td><td>Name</td><td>Cost</td><td>&nbsp;</td></tr>", true);