- Joined
- Apr 27, 2008
- Messages
- 330
- Reaction score
- 370
manage/pages/configs.php
manage/top.php
add:
SQL:
Code:
<?php
/*=======================================================================
| UberCMS - Advanced Website and Content Management System for uberEmu
| #######################################################################
| Copyright (c) 2010, Roy 'Meth0d' and updates by Matthew 'MDK'
| http://www.meth0d.org & http://www.sulake.biz
| #######################################################################
| 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 3 of the License, or
| (at your option) any later version.
| #######################################################################
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
\======================================================================*/
if (!defined('IN_HK') || !IN_HK)
{
exit;
}
if (!HK_LOGGED_IN || !$users->hasFuse(USER_ID, 'fuse_admin'))
{
exit;
}
if (isset($_POST['edit-no']))
{
dbquery("UPDATE config SET variable_name = '" . filter($_POST['key']) . "', value = '" . filter($_POST['value']) . "' WHERE variable_name = '" . filter($_POST['edit-no']) . "' LIMIT 1");
}
if (isset($_POST['newkey']))
{
dbquery("INSERT INTO config (variable_name,value) VALUES ('" . filter($_POST['newkey']) . "','" . filter($_POST['newval']) . "')");
}
if (isset($_GET['doDel']))
{
dbquery("DELETE FROM config WHERE variable_name = '" . filter($_GET['doDel']) . "' LIMIT 1");
fMessage('ok', 'Key removed.');
header("Location: index.php?_cmd=configs");
exit;
}
require_once "top.php";
echo '<h1>System Configs</h1>';
echo '<p>This tool is config editor.</p><br />';
echo '<table border="1" width="100%">';
echo '<thead>';
echo '<tr>';
echo '<td>Key</td>';
echo '<td>Value</td>';
echo '<td>Controls</td>';
echo '</tr>';
$get = dbquery("SELECT * FROM config");
while ($text = mysql_fetch_assoc($get))
{
echo '<tr><form method="post">';
echo '<input type="hidden" name="edit-no" value="' . clean($text['variable_name']) . '">';
echo '<td><input type="text" style="width: 100%; padding: 10px; font-size: 115%;" name="key" value="' . clean($text['variable_name']) . '"></td>';
echo '<td><textarea style="width: 100%; height: 100%;" name="value">' . clean($text['value']) . '</textarea></td>';
echo '<td><center><input type="submit" value="Update"> <input type="button" value="Delete" onclick="window.location = \'index.php?_cmd=configs&doDel=' . $text['variable_name'] . '\';"></center></td>';
echo '</form></tr>';
}
echo '<tr><form method="post">';
echo '<td><input type="text" style="width: 100%; padding: 10px; font-size: 115%;" name="newkey"></td>';
echo '<td><textarea name="newval" style="width: 100%; height: 100%;"></textarea>';
echo '<td><center><input type="submit" value="Add">';
echo '</form></tr>';
echo '</thead>';
echo '</table>';
require_once "bottom.php";
?>
manage/top.php
add:
Code:
<li><a href="index.php?_cmd=configs">System Configs</a></li>
SQL:
Code:
CREATE TABLE `config` (
`variable_name` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Attachments
You must be registered for see attachments list
Last edited: