Location: PHPKode > projects > Murmuradmin > users.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
    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'>";

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

if ($action == "DeleteUser") {
	if (isset($_REQUEST['uid'])) {
		$uid = $_REQUEST['uid'];
		$server->unregisterPlayer($uid + 0);
		echo "<div class='header'>Account Deleted!</div>";
	} else {
		echo "<div class='header'>Unknown User!</div>\n";

if ($action == "EditUser") {
	if (isset($_REQUEST['uid'])) {
		$uid = (int)$_REQUEST['uid'];
		$user = $server->getRegistration($uid + 0);
		if (!empty($user->email)) {
			$email = clean($user->email);
		if (isset($_REQUEST['set'])) {
			$user->email = clean($_REQUEST['emailaddr']);
			$user->pw = clean($_REQUEST['pw']);
			echo "<div class='header'>Account Updated!</div><br>";
		} else {
			echo "<div class='header'>Edit User : '$user->name'</div><br>";
			echo "<form method='get' name='edituser' action='".$_SERVER['PHP_SELF']."'>\n";
			echo "<center><table>\n";
			echo "<input type='hidden' name='set' value='1' />\n";
			echo "<input type='hidden' name='uid' value='$uid' />\n";
			echo "<b>Email:</b> <input type='text' name='emailaddr' size='30' maxlength='80' value='".$email."' /><br />\n";
			echo "<b>New password:</b> <input type='password' name='pw' size='30' maxlength='40' value='".$user->pw."'/><br />\n";
			echo "<input type='submit' value='EditUser' name='action'>\n";
			echo "</table></center>\n";
			echo "</form><br>\n";
	} else {
		echo "<div class='header'>Unknown User!</div><br>\n";

try {
	echo "<div class='header'>Registered User List</div>\n";
	echo "<table id='hor-minimalist-b'>\n";
	echo "<tr><th>UserName</th><th>Email</th><th>";
	echo "</th></tr>\n";
	$users = $server->getRegisteredPlayers("");
	//usort($users, "ucmp");
	foreach($users as $u) {
		echo "<tr><td>$u->name</td><td>".$u->email."</td><td>";
		if ($u->playerid != 0) {
			echo "<a href='?action=EditUser&uid=".$u->playerid."'>[Edit]</a> ";
			echo "<a href='?action=DeleteUser&uid=".$u->playerid."'>[Unregister]</a> ";
		echo "</td></tr>\n";
	echo "</table>\n";

catch (Ice_Exception $ex) {
	echo "<div class='header'>Server OffLine</div>\n";

include 'footer.php';

Return current item: Murmuradmin