diff --git a/webui/user-add.php b/webui/user-add.php
index 1d428089d1c7e833c63addf68f0366b6480afa6f..559bfa8113f1a274f25a513f66c1e9406c9291e7 100644
--- a/webui/user-add.php
+++ b/webui/user-add.php
@@ -55,63 +55,45 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
 
 # Check we have all params
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") {
-
 ?>
-
 	<p class="pageheader">User Add Results</p>
-
 <?php
 
 	# Check name
 	if (empty($_POST['user_name'])) {
-
 ?>
-
 		<div class="warning">Username cannot be empty</div>
-
 <?php
-
 	}
-	else if (!preg_match('/^[a-z0-9]+$/i', $_POST['user_name'])) {
 
+	else if (!preg_match('/^[a-z0-9]+$/i', $_POST['user_name'])) {
 ?>
-
 		<div class="warning">Username invalid: must be alphanumeric</div>
-
 <?php
 
 	# Add to database
 	} else {
 		$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}users (Username) VALUES (?)");
 		$res = $stmt->execute(array(
-				$_POST['user_name'],
-				));
+			$_POST['user_name'],
+		));
 		# Was it successful?
 		if ($res) {
-
 ?>
-
 			<div class="notice">User added</div>
-
 <?php
-
 		} else {
-
 ?>
-
 			<div class="warning">Failed to add user</div>
 			<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
-
 <?php
-
 		}
+
 	}
-} else {
 
+} else {
 ?>
-
 	<div class="warning">Invalid invocation</div>
-
 <?php
 
 }
diff --git a/webui/user-attribute-add.php b/webui/user-attribute-add.php
index 85a829f100f0e2bd9b61d730fa9164e0cd28b063..a887590b71d0de18cc0aab3f087e6f21b50cbf26 100644
--- a/webui/user-attribute-add.php
+++ b/webui/user-attribute-add.php
@@ -16,8 +16,6 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-session_start();
-
 include_once("includes/header.php");
 include_once("includes/footer.php");
 include_once("includes/db.php");
@@ -38,9 +36,7 @@ printHeader(array(
 
 
 if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
-
 ?>
-
 	<p class="pageheader">Add attribute</p>
 
 	<form method="post" action="user-attribute-add.php">
@@ -85,68 +81,48 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
 			</tr>
 		</table>
 	</form>
-
 <?php
 
 # Check we have all params
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") {
-
 ?>
-
 	<p class="pageheader">Attribute Add Results</p>
-
 <?php
 
 	# Check for empty values
 	if (empty($_POST['attr_name']) || empty($_POST['attr_operator']) || empty($_POST['attr_value'])) {
-
 ?>
-
 		<div class="warning">Submission cannot have empty value</div>
-
 <?php
 
 	} else {
 		$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}user_attributes (UserID,Name,Operator,Value) VALUES (?,?,?,?)");
-		# Which user am I working with?
-		$attr_user_id = $_SESSION['attr_user_id']; 
 
 		$res = $stmt->execute(array(
-			$attr_user_id,
+			$_POST['attr_userid'],
 			$_POST['attr_name'],
 			$_POST['attr_operator'],
 			$_POST['attr_value'],
 		));
 		if ($res) {
-
 ?>
-
 			<div class="notice">Attribute added</div>
-
 <?php
-
-			session_destroy();
-
 		} else {
-
 ?>
-
 			<div class="warning">Failed to add attribute</div>
 			<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
-
 <?php
-
 		}
+
 	}
-} else {
 
+} else {
 ?>
-
 	<div class="warning">Invalid invocation</div>
-
 <?php
-
 }
+
 printFooter();
 
 # vim: ts=4
diff --git a/webui/user-attribute-change.php b/webui/user-attribute-change.php
index 6f5a94d77f8e292c6cc18bea2ec337001536fb36..40a6e624e96ce49c4eeca7e5e3e2b0fcec991576 100644
--- a/webui/user-attribute-change.php
+++ b/webui/user-attribute-change.php
@@ -38,15 +38,22 @@ printHeader(array(
 
 # Display change screen
 if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") {
+
 	# Check an attribute was selected
 	if (isset($_POST['attr_id'])) {
 		# Prepare statement
-		$sql = "SELECT ID, Name, Operator, Value, Disabled FROM ${DB_TABLE_PREFIX}user_attributes WHERE ID = ".$db->quote($_POST['attr_id']);
+		$sql = "
+			SELECT 
+				ID, Name, Operator, Value, Disabled 
+			FROM 
+				${DB_TABLE_PREFIX}user_attributes 
+			WHERE 
+				ID = ".$db->quote($_POST['attr_id']."
+		");
 		$res = $db->query($sql); 
 		$row = $res->fetchObject();
 
 ?>
-
 		<p class="pageheader">Update User</p>
 
 		<form action="user-attribute-change.php" method="post">
@@ -122,23 +129,16 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") {
 
 	$res->closeCursor();
 	} else {
-
 ?>
-
 		<div class="warning">No attribute selected</div>
-
 <?php
-
 	}
+
 # SQL Updates
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "change2") {
-
 ?>
-
 	<p class="pageheader">Attribute Update Results</p>
-
 <?php
-
 	# Check an attribute was selected
 	if (isset($_POST['attr_id'])) {
 
@@ -161,58 +161,46 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") {
 		if (sizeof($updates) > 0) {
 			$updateStr = implode(', ',$updates);
 
-			$res = $db->exec("UPDATE ${DB_TABLE_PREFIX}user_attributes SET $updateStr WHERE ID = ".$db->quote($_POST['attr_id']));
-			if ($res) {
-
+			$res = $db->exec("
+				UPDATE 
+					${DB_TABLE_PREFIX}user_attributes 
+				SET 
+					$updateStr 
+				WHERE 
+					ID = ".$db->quote($_POST['attr_id']."
+			"));
+			if ($res !== FALSE) {
 ?>
-
 				<div class="notice">Attribute updated</div>
-
 <?php
-
 			} else {
-
 ?>
-
 				<div class="warning">Error updating attribute</div>
 				<div class="warning"><?php print_r($db->errorInfo()) ?></div>
-
 <?php
-
 			}
+
 		# Warn
 		} else {
-
 ?>
-
 			<div class="warning">No attribute updates</div>
-
 <?php
-
 		}
+
 	# Warn
 	} else {
-
 ?>
-
 		<div class="error">No attribute data available</div>
-
 <?php
-
 	}
-} else {
 
+} else {
 ?>
-
 	<div class="warning">Invalid invocation</div>
-
 <?php
-
 }
 
-
 printFooter();
 
-
 # vim: ts=4
 ?>
diff --git a/webui/user-attribute-delete.php b/webui/user-attribute-delete.php
index f8fc42ee18bee0fd8a4beb3839a2a0699a59ba57..078847a8783e5d4d194a90226f33a7238f3be525 100644
--- a/webui/user-attribute-delete.php
+++ b/webui/user-attribute-delete.php
@@ -38,11 +38,10 @@ printHeader(array(
 
 # Display delete confirm screen
 if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
+
 	# Check a user was selected
 	if (isset($_POST['attr_id'])) {
-
 ?>
-
 		<p class="pageheader">Delete Attribute</p>
 
 		<form action="attribute-delete.php" method="post">
@@ -56,70 +55,50 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
 				<input type="submit" name="confirm" value="no" />
 			</div>
 		</form>
-
 <?php
 
 	} else {
-
 ?>
-
 		<div class="warning">No attribute selected</div>
-
 <?php
-
 	}
+
 # SQL Updates
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") {
-
 ?>
-
 	<p class="pageheader">Attribute Delete Results</p>
-
 <?php
-
 	if (isset($_POST['attr_id'])) {
+
 		if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") {
+
 			$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}user_attributes WHERE ID = ".$db->quote($_POST['attr_id']));
 			if ($res !== FALSE) {
-
 ?>
-
 				<div class="notice">Attribute with ID: <?php echo $_POST['attr_id']; ?> deleted</div>
-
 <?php
-
 			} else {
-
 ?>
-
 				<div class="warning">Error deleting attribute</div>
 				<div class="warning"><?php print_r($db->errorInfo()) ?></div>
-
 <?php
-
 			}
+
 		# Warn
 		} else {
-
 ?>
-
 		<div class="warning">Delete attribute aborted</div>
-
 <?php
-
 		}
-	} else {
 
+	} else {
 ?>
-
 		<div class="warning">Invocation error, no attribute ID selected</div>
-
 <?php
-
 	}
 }
-printFooter();
 
+printFooter();
 
 # vim: ts=4
 ?>
diff --git a/webui/user-attributes.php b/webui/user-attributes.php
index 5d2d6652b514be09f4734a0dbe56182456ee9a3c..421c2e5fd95d4c584d8f8210f89e1863ce58e53c 100644
--- a/webui/user-attributes.php
+++ b/webui/user-attributes.php
@@ -17,8 +17,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-session_start();
-
 include_once("includes/header.php");
 include_once("includes/footer.php");
 include_once("includes/db.php");
@@ -76,27 +74,22 @@ printHeader(array(
 		</tr>
 
 <?php
-
 		if (isset($_POST['user_id'])) {
-			# Set to session for later use
-			$_SESSION['attr_user_id'] = $_POST['user_id']; 
-
 			# Get old attributes
-			$sql = "SELECT 
-						ID, Name, Operator, Value, Disabled 
-					FROM 
-						${DB_TABLE_PREFIX}user_attributes 
-					WHERE 
-						UserID = ".$db->quote($_POST['user_id'])." 
-					ORDER BY 
-						ID
-					";
+			$sql = "
+				SELECT 
+					ID, Name, Operator, Value, Disabled 
+				FROM 
+					${DB_TABLE_PREFIX}user_attributes 
+				WHERE 
+					UserID = ".$db->quote($_POST['user_id'])." 
+				ORDER BY 
+					ID
+			";
 
 			$res = $db->query($sql);
 			while ($row = $res->fetchObject()) {
-
 ?>
-
 				<tr class="resultsitem">
 					<td><input type="radio" name="attr_id" value="<?php echo $row->id; ?>"/><?php echo $row->id; ?></td>
 					<td><?php echo $row->name; ?></td>
@@ -104,40 +97,31 @@ printHeader(array(
 					<td><?php echo $row->value; ?></td>
 					<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td>
 				</tr>
-
 <?php
-
 			}
-			if ($res->rowCount() == 0) {
 
+			if ($res->rowCount() == 0) {
 ?>
-
 				<p />
 				<tr>
 					<td colspan="5" class="textcenter">Attribute list is empty</td>
 				</tr>
-
 <?php
-
 			}
+
 			$res->closeCursor();
-		} else {
 
+		} else {
 ?>
-
 			<tr class="resultitem">
 				<td colspan="5" class="textcenter">No User ID selected</td>
 			</tr>
-
 <?php
-
 		}
 
 ?>
-
 	</table>
 </form>
-
 <?php
 
 printFooter();
diff --git a/webui/user-delete.php b/webui/user-delete.php
index 6a1b8bf857af3b21f07f184584c30351ef226deb..d9a4ac0fceccf7967ed613e9c265a119688a5f86 100644
--- a/webui/user-delete.php
+++ b/webui/user-delete.php
@@ -38,11 +38,10 @@ printHeader(array(
 
 # Display delete confirm screen
 if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
+
 	# Check a user was selected
 	if (isset($_POST['user_id'])) {
-
 ?>
-
 		<p class="pageheader">Delete User</p>
 
 		<form action="user-delete.php" method="post">
@@ -54,29 +53,24 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
 				<input type="submit" name="confirm" value="no" />
 			</div>
 		</form>
-
 <?php
 
 	} else {
-
 ?>
-
 		<div class="warning">No user selected</div>
-
 <?php
-
 	}
+
 # SQL Updates
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") {
-
 ?>
-
 	<p class="pageheader">User Delete Results</p>
-
 <?php
 
 	if (isset($_POST['user_id'])) {
+
 		if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") {
+
 			$db->beginTransaction();
 
 			$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}users_to_groups WHERE UserID = ".$db->quote($_POST['user_id']));
@@ -86,39 +80,46 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
 <?php
 			} else {
 ?>
-				<div class="warning">Error deleting user</div>
+				<div class="warning">Error removing groups from user</div>
 				<div class="warning"><?php print_r($db->errorInfo()); ?></div>
 <?php
-				$db->rollback();
 			}
 
 			if ($res !== FALSE) {
-				$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}wisp_userdata WHERE UserID = ".$db->quote($_POST['user_id']));
+				$res = $db->exec("
+					DELETE FROM 
+						${DB_TABLE_PREFIX}wisp_userdata
+					WHERE 
+						UserID = ".$db->quote($_POST['user_id']."
+				"));
 				if ($res !== FALSE) {
 ?>
-					<div class="notice">Userdata deleted</div>
+					<div class="notice">WiSP user data deleted</div>
 <?php
 				} else {
 ?>
-					<div class="warning">Error deleting user</div>
+					<div class="warning">Error removing WiSP user data</div>
 					<div class="warning"><?php print_r($db->errorInfo()); ?></div>
 <?php
-					$db->rollback();
 				}
 			}
 
 			if ($res !== FALSE) {
-				$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}user_attributes WHERE UserID = ".$db->quote($_POST['user_id']));
+				$res = $db->exec("
+					DELETE FROM 
+						${DB_TABLE_PREFIX}user_attributes 
+					WHERE 
+						UserID = ".$db->quote($_POST['user_id'])."
+				");
 				if ($res !== FALSE) {
 ?>
 					<div class="notice">User attributes deleted</div>
 <?php
 				} else {
 ?>
-					<div class="warning">Error deleting user</div>
+					<div class="warning">Error removing user attributes</div>
 					<div class="warning"><?php print_r($db->errorInfo()); ?></div>
 <?php
-					$db->rollback();
 				}
 			}
 
@@ -130,39 +131,45 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
 <?php
 				} else {
 ?>
-					<div class="warning">Error deleting user</div>
+					<div class="warning">Error removing user</div>
 					<div class="warning"><?php print_r($db->errorInfo()); ?></div>
 <?php
-					$db->rollback();
 				}
 			}
-			if ($res) {
+
+			# Check if all is ok, if so, we can commit, else must rollback
+			if ($res !== FALSE) {
+				$db->commit();
 ?>
-				<div class="notice">User with ID: <?php echo $_POST['user_id']; ?> deleted</div>
+				<div class="notice">Changes comitted.</div>
+<?php
+			} else {
+				$db->rollback();
+?>
+				<div class="notice">Changes reverted.</div>
 <?php
-				$db->commit();
 			}
+
 		} else {
 ?>
 			<div class="warning">Delete user aborted</div>
 <?php
 		}
+
 	} else {
 ?>
-
 		<div class="warning">Invocation error, no user ID selected</div>
-
 <?php
-
 	}
+
 } else {
 ?>
 	<div class="warning">Invocation error</div>
 <?php
 }
+
 printFooter();
 
 
 # vim: ts=4
 ?>
-
diff --git a/webui/user-groups-add.php b/webui/user-groups-add.php
index a281576165b0e64ae216c71d85ade6edb9d1b6fc..c2cbe337caeeb70090c10ea3b0977834c6236a4e 100644
--- a/webui/user-groups-add.php
+++ b/webui/user-groups-add.php
@@ -17,9 +17,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-session_start();
-
-
 include_once("includes/header.php");
 include_once("includes/footer.php");
 include_once("includes/db.php");
@@ -32,7 +29,8 @@ printHeader(array(
 ));
 
 
-if (isset($_SESSION['groups_user_id'])) {
+if (isset($_POST['groups_user_id'])) {
+
 	if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
 
 ?>
@@ -79,9 +77,7 @@ if (isset($_SESSION['groups_user_id'])) {
 				$res = $db->query($sql);
 
 				while ($row = $res->fetchObject()) {
-
 ?>
-
 					<tr class="resultsitem">
 						<td><input type="radio" name="group_id" value="<?php echo $row->id; ?>" /></td>
 						<td><?php echo $row->name; ?></td>
@@ -89,73 +85,59 @@ if (isset($_SESSION['groups_user_id'])) {
 						<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td>
 						<td><?php echo $row->comment; ?></td>
 					</tr>
-
 <?php
-
 				}
-				$res->closeCursor();
 
+				$res->closeCursor();
 ?>
-
 			</table>
 		</form>
 
 <?php
 
 	} elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") {
-
 ?>
-
 		<p class="pageheader">Group assignment results</p>
-
 <?php
 
 		if (isset($_POST['group_id']) && !empty($_POST['users_to_groups_comment'])) {
-			$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}users_to_groups (UserID,GroupID,Comment,Disabled) VALUES (?,?,?,?)");
+			$stmt = $db->prepare("
+				INSERT INTO ${DB_TABLE_PREFIX}users_to_groups 
+					(UserID,GroupID,Comment,Disabled) 
+				VALUES 
+					(?,?,?,?)
+			");
 
 			$res = $stmt->execute(array(
-						$_SESSION['groups_user_id'],
+						$_POST['groups_user_id'],
 						$_POST['group_id'],
 						$_POST['users_group_comment'],
 						$_POST['users_group_disabled'],
 						));
 
-			if ($res) {
-
+			if ($res !== FALSE) {
 ?>
-
 				<div class="notice">Group assignment successful</div>
-
 <?php
-
 			} else {
-
 ?>
-
 				<div class="warning">Failed to assign group to user</div>
 				<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
-
 <?php
-
 			}
-		} else {
 
+		} else {
 ?>
-
 			<div class="warning">One or more values not set</div>
-
 <?php
-
 		}
+
 	}
-} else {
 
+} else {
 ?>
-
-	<div class="warning">No user id received</div>
-
+	<div class="warning">No user ID received</div>
 <?php
-
 }
 
 printFooter();
diff --git a/webui/user-groups-delete.php b/webui/user-groups-delete.php
index 2ef68ff7dc86d77b1bc6a76821a78316fad56495..0a71a2c7a1d7bca4a09392a0632728ad3bbb3559 100644
--- a/webui/user-groups-delete.php
+++ b/webui/user-groups-delete.php
@@ -17,8 +17,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-session_start();
-
 include_once("includes/header.php");
 include_once("includes/footer.php");
 include_once("includes/db.php");
@@ -38,11 +36,10 @@ printHeader(array(
 
 # Display delete confirm screen
 if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
+
 	# Check a user was selected
 	if (isset($_POST['group_id'])) {
-
 ?>
-
 		<p class="pageheader">Remove Group Assignment</p>
 
 		<form action="user-groups-delete.php" method="post">
@@ -56,77 +53,55 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
 				<input type="submit" name="confirm" value="no" />
 			</div>
 		</form>
-
 <?php
 
 	} else {
-
 ?>
-
 		<div class="warning">No group assignment selected</div>
-
 <?php
-
 	}
+
 # SQL Updates
 } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") {
-
 ?>
-
 	<p class="pageheader">Group Assignment Removal Results</p>
-
 <?php
+	if (isset($_POST['group_id']) && isset($_POST['groups_user_id'])) {
 
-	if (isset($_POST['group_id']) && isset($_SESSION['groups_user_id'])) {
 		if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") {
 			$res = $db->exec("	
-								DELETE FROM 
-										${DB_TABLE_PREFIX}users_to_groups 
-								WHERE 
-										UserID = ".$db->quote($_SESSION['groups_user_id'])." 
-								AND 
-										GroupID = ".$db->quote($_POST['group_id'])
-							);
+				DELETE FROM 
+					${DB_TABLE_PREFIX}users_to_groups 
+				WHERE 
+					UserID = ".$db->quote($_SESSION['groups_user_id'])." 
+					AND GroupID = ".$db->quote($_POST['group_id'])."
+			");
 
 			if ($res !== FALSE) {
-
 ?>
-
-				<div class="notice">Group with ID: <?php print_r($_POST['group_id']);?> deleted from user with ID: <?php print_r($_SESSION['groups_user_id']);?></div>
-
+				<div class="notice">Group removed from user</div>
 <?php
-
-				session_destroy();
 			} else {
-
 ?>
-
 				<div class="warning">Error removing group assignment</div>
 				<div class="warning"><?php print_r($db->errorInfo()); ?></div>
-
 <?php
-
 			}
+
 		# Warn
 		} else {
-
 ?>
-
 			<div class="warning">Remove Group Assignment aborted</div>
-
 <?php
-
 		}
-	} else {
 
+	} else {
 ?>
-
 		<div class="warning">Invocation error, no group ID selected</div>
-
 <?php
-
 	}
 }
+
 printFooter();
 
 
diff --git a/webui/user-groups.php b/webui/user-groups.php
index 1a2f49ab94ae1afb7a258653ac4d274e5e86bab4..5a2ede3950db35a0715076abfd1ee9a00d415562 100644
--- a/webui/user-groups.php
+++ b/webui/user-groups.php
@@ -17,9 +17,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-session_start();
-
-
 include_once("includes/header.php");
 include_once("includes/footer.php");
 include_once("includes/db.php");
@@ -76,20 +73,23 @@ printHeader(array(
 <?php
 
 		if (isset($_POST['user_id'])) {
-
-			# Store user_id for later use
-			$_SESSION['groups_user_id'] = $_POST['user_id'];
-
 			$sql = "SELECT GroupID FROM ${DB_TABLE_PREFIX}users_to_groups WHERE UserID = ".$db->quote($_POST['user_id']);
 			$res = $db->query($sql);
 
 			while ($row = $res->fetchObject()) {
-				$sql = "SELECT ID, Name, Priority, Disabled, Comment FROM ${DB_TABLE_PREFIX}groups WHERE ID = ".$db->quote($row->groupid);
-				$result = $db->query($sql);
-
-				while ($row = $result->fetchObject()) {
+				$sql = "
+					SELECT 
+						ID, Name, Priority, Disabled, Comment
+					FROM 
+						${DB_TABLE_PREFIX}groups 
+					WHERE 
+						ID = ".$db->quote($row->groupid)."
+				";
+				$res2 = $db->query($sql);
+
+				while ($row = $res2->fetchObject()) {
 ?>
-					<tr class="resultsitem">
+					<tr class="res2">
 						<td><input type="radio" name="group_id" value="<?php echo $row->id; ?>"/></td>
 						<td><?php echo $row->name; ?></td>
 						<td><?php echo $row->priority; ?></td>
@@ -98,8 +98,10 @@ printHeader(array(
 					</tr>
 <?php
 				}
-				$result->closeCursor();
+
+				$res2->closeCursor();
 			}
+
 			if ($res->rowCount() == 0) {
 ?>
 				<tr>
@@ -107,7 +109,9 @@ printHeader(array(
 				</tr>
 <?php
 			}
+
 			$res->closeCursor();
+
 		} else {
 ?>
 			<tr>
@@ -122,6 +126,5 @@ printHeader(array(
  
 printFooter();
 
-
 # vim: ts=4
 ?>
diff --git a/webui/user-logs.php b/webui/user-logs.php
index 5d7e0c1fc3841c43a2b9af1781ec9bd637332eb4..057df1a6fdfb19f252905bf0bff88d991fd748d4 100644
--- a/webui/user-logs.php
+++ b/webui/user-logs.php
@@ -126,34 +126,34 @@ if (isset($_POST['user_id'])) {
 		# Query to get all default data
 		$sql = "
 			SELECT
-					EventTimestamp, 
-					ServiceType,
-					FramedProtocol,
-					NASPort,
-					NASPortType, 
-					CallingStationID, 
-					CalledStationID, 
-					NASPortID, 
-					AcctSessionID, 
-					FramedIPAddress, 
-					AcctAuthentic, 
-					NASIdentifier, 
-					NASIPAddress, 
-					AcctDelayTime, 
-					AcctSessionTime, 
-					AcctInputOctets, 
-					AcctInputGigawords, 
-					AcctOutputOctets, 
-					AcctOutputGigawords, 
-					AcctStatusType, 
-					AcctTerminateCause 
+				EventTimestamp, 
+				ServiceType,
+				FramedProtocol,
+				NASPort,
+				NASPortType, 
+				CallingStationID, 
+				CalledStationID, 
+				NASPortID, 
+				AcctSessionID, 
+				FramedIPAddress, 
+				AcctAuthentic, 
+				NASIdentifier, 
+				NASIPAddress, 
+				AcctDelayTime, 
+				AcctSessionTime, 
+				AcctInputOctets, 
+				AcctInputGigawords, 
+				AcctOutputOctets, 
+				AcctOutputGigawords, 
+				AcctStatusType, 
+				AcctTerminateCause 
 			FROM 
-					${DB_TABLE_PREFIX}accounting 
+				${DB_TABLE_PREFIX}accounting 
 			WHERE 
-					Username = ".$db->quote($getuser)."
-					$extraSQL
+				Username = ".$db->quote($getuser)."
+				$extraSQL
 			ORDER BY
-					EventTimestamp
+				EventTimestamp
 			DESC
 				$limitSQL
 			";
@@ -199,9 +199,7 @@ if (isset($_POST['user_id'])) {
 			}
 
 			$totalSessionTime += $sessionTimeItem;
-
 ?>
-
 			<tr class="resultsitem">
 				<td class="textcenter"><?php echo $row->eventtimestamp; ?></td>
 				<td class="textcenter"><?php echo $row->servicetype; ?></td>
@@ -223,25 +221,19 @@ if (isset($_POST['user_id'])) {
 				<td class="textcenter"><?php echo $row->acctstatustype; ?></td>
 				<td class="textcenter"><?php echo strRadiusTermCode($row->acctterminatecause); ?></td>
 			</tr>
-
 <?php
-
 		}
 
 		if ($res->rowCount() == 0) {
-
 ?>
 
 			<tr>
 				<td colspan="23" class="textcenter">No logs found for user: <?php echo $getuser ?></td>
 			</tr>
-
 <?php
 
 		} else {
-
 ?>
-
 			<tr class="resultsitem">
 				<td class="textcenter"></td>
 				<td class="textcenter"></td>
@@ -263,25 +255,21 @@ if (isset($_POST['user_id'])) {
 				<td class="textcenter"></td>
 				<td class="textcenter"></td>
 			</tr>
-
 <?php
-
 		}
+
 		$res->closeCursor();
 ?>
 	</table>
 <?php
 
 } else {
-
 ?>
 	<div class="warning">No user selected</div>
 <?php
-
 }
 
 printFooter();
 
-
 # vim: ts=4
 ?>
diff --git a/webui/user-main.php b/webui/user-main.php
index 3757787ec807982a8fb4948bbf37c0a1a09c6758..f3e6c1dd1de2c66e124c38b04f9265678f8ab7fb 100644
--- a/webui/user-main.php
+++ b/webui/user-main.php
@@ -81,9 +81,7 @@ if (!isset($_POST['frmaction']))
 
 			# List users
 			while ($row = $res->fetchObject()) {
-
 ?>
-
 					<tr class="resultsitem">
 						<td><input type="radio" name="user_id" value="<?php echo $row->id; ?>"/><?php echo $row->id; ?></td>
 						<td><?php echo $row->username; ?></td>
@@ -91,6 +89,7 @@ if (!isset($_POST['frmaction']))
 					</tr>
 <?php
 			}
+
 			if ($res->rowCount() == 0) {
 ?>
 				<p />
@@ -99,12 +98,14 @@ if (!isset($_POST['frmaction']))
 				</tr>
 <?php
 			}
+
 			$res->closeCursor();
 ?>
 		</table>
 	</form>
 <?php
 }
+
 printFooter();
 
 # vim: ts=4