Location: PHPKode > projects > Murmuradmin > serverconfig.php
<?php
/*  Murmur WebAdministrator - Administration of Murmur Server on web for end users.
    Copyright (C) 2009  Kevin Traub

    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.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

include 'config.php';
include 'functions.php';

if ($_SESSION['IsAdmin'] != "1") {
	echo "<META HTTP-EQUIV='refresh' CONTENT='0;URL=/login.php'>";
	exit();
}

echo basecss();
echo basemenu($logged, $meta, $serverid);

switch ($_POST['Submit']) {
	case 'Update Server' :
		$conf = $server->getAllConf();
		$default = $meta->getDefaultConf();
		$default['port'] += $server->id() - 1;
	   	if ($_SESSION['username'] == "SuperAdmin") {
	    	foreach($confadmin as $key=>$desc) {
	    		$server->setConf($key, $_REQUEST[$key]);
	    		}
		}
	   	foreach($confitems as $key=>$desc) {
	    	$server->setConf($key, $_REQUEST[$key]);
	    }
		echo "<div class='header'>Server Updated!</div><div>\n";
	break;

}

$conf = $server->getAllConf();
$default = $meta->getDefaultConf();
$default['port'] += $server->id() - 1;
echo "<div class='header'>Server Configuration</div>\n";
echo "<span class='alt_text'><center>Server Expires : ".date('F j, Y',(int)$server->getConf('expire'))."</center></span><br>\n";
echo "<center>";
if ($_SESSION['username'] == "SuperAdmin") {
	// Server configuration for SuperAdmins...
	// Add additional configuration settings in $confadmin above
	echo "<table id='hor-minimalist-b'><tr><th>Description</th><th>Default</th><th>Current Setting</th></tr>\n";
	foreach($confadmin as $key=>$desc) {
		echo "<tr><td>$desc</td><td>".htmlspecialchars($default[$key])."</td><td>";
		echo "<input type='text' name='$key' size='30' maxlength='64000' value='".htmlspecialchars($conf[$key])."' />";
		echo "</td></tr>\n";
	}
	echo "<tr><td>Expiry Date</td><td>".(date('F j, Y',(int)$server->getConf('expire')))."</td><td>";
	echo "<div align='center'><a href='reset.php'>Add 30 days to expiry</a></div></td></tr><tr><td colspan='3'><center><a href='start.php?Submit=delete'>DELETE SERVER</a></center></td></tr>";
} else {
	// Configuration settings we want to show the superuser.
	// but not allow them to change.
	echo "<table id='hor-minimalist-b'><tr><th>Description</th><th>Current Setting</th></tr>\n";
	echo "<tr><td>Server Type</td><td>".$server->getConf('type')."</td><td>";
	echo "<tr><td>Expiry Date</td><td>".(date('F j, Y',(int)$server->getConf('expire')))."</td><td>";
	echo "<tr><td>IP Address</td><td>".$server->getConf('host')."</td><td>";
	echo "<tr><td>Port</td><td>".$server->getConf('port')."</td><td>";
	echo "<tr><td>Maximum Users on server</td><td>".$server->getConf('users')."</td><td>";
	echo "<tr><td>Maximum Bandwidth (bytes/sec)</td><td>".$server->getConf('bandwidth')."</td><td>";
}
echo "</table></center>";
if ($server->isRunning() == FALSE) {
	echo "<div align='center'><a href='start.php?Submit=start'><span class='alt_text'>Start Server</span></a></div>";
} else {
	echo "<div align='center'><a href='start.php?Submit=stop'><span class='alt_text'>Stop Server</span></a></div>";
}
echo "<hr><div class='header'>Customizable Settings</div>\n";
echo "<form method='post' name='config' action='".$_SERVER['PHP_SELF']."'>\n";
echo "<div>\n";
echo "</div>\n";
echo "<table id='hor-minimalist-b'><tr><th>Description</th><th>Default</th><th>Value</th></tr>\n";
foreach($confitems as $key=>$desc) {
	if (! isset($confbig[$key])) {
		echo "<tr><td>$desc</td><td>".htmlspecialchars($default[$key])."</td><td>";
		echo "<input type='text' name='$key' size='30' maxlength='64000' value='".htmlspecialchars($conf[$key])."' />";
		echo "</td></tr>\n";
	} else {
		echo "<tr><td>$desc</td><td colspan='2'><textarea rows='5' cols='80' name='$key'>".htmlspecialchars($conf[$key])."</textarea>";
		echo "</td></tr>\n";
	}
}
echo "</table>\n";
echo "<div><center><input type='submit' value='Update Server' name='Submit'></div>\n";
echo "</center></form>\n";

include 'footer.php';
?>
Return current item: Murmuradmin