Update of /cvsroot/phpmp/phpMP/includes
In directory sc8-pr-cvs1:/tmp/cvs-serv29415/includes
Added Files:
admin.php
Log Message:
Powers the admin/main.php file - will handle all admin actions
--- NEW FILE: admin.php ---
<?php
class Admin
{
var $p_action;
// Executes the given admin action
// Author: Anthony White
// Accepts: $action - actions as defined above, used in switch / case
// Returns: none.
function execute($action)
{
switch ($action)
{
case C_ACTION_GENERAL:
$this->p_action = $action;
$this->_show_general();
break;
default: break;
}
}
// Shows the general management form
// Author: Anthony White
// Accepts: none.
// Returns: none.
function _show_general()
{
// Print out a form for the user
print "<form method=\"post\" action=\"main.php?parse=" . $this->p_action . "\">";
print "Site Name: <input type=\"text\" name=\"sname\"><br>";
print "<input type=\"submit\" name=\"submit_general\">";
}
// Parses the general management form
// Author: Anthony White
// Accepts: Form values from the general form
// Returns: none.
function parse_general($sname)
{
include_once( C_PHPMP_ROOT . 'dba/' . DB_TYPE . '.dba' );
$DB = new DB;
// We now go through each config_value and update it accordingly
// I dont know if this is the only way, but it works fine for me
$query = $DB->query("UPDATE " . DB_CONFIG_TABLE . " SET config_value='" . $sname . "' WHERE config_key='site_name'");
if (!$query)
{
die ("Error executing query");
}
}
}
?>
|