Location: PHPKode > projects > XMail PHP Admin Interface (XPAI) > xpai/includes/userlist.php
<?php
if (!$in_xpai)
  die;

if (($_SESSION['loginstatus'] >= $login_level['LoginPostmaster']) && ($_SESSION['edit_domain'] != "*"))
{
  function vergleich($a, $b)
  {
    return (strcmp($a[1], $b[1]));
  }
  echo "<h1><a href=\"javascript:help('xpai_help.html#userlist','".$helpwidth."','".$helpheight."')\"><img src='gfx/ico_help.png' alt='Help' border='0'></a>&nbsp;&nbsp;";
  echo "Users in domain<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"blue\">".$_SESSION['edit_domain']."</span></h1>";

  if (!isset($_REQUEST['Go']))
  {
?>
  	<form name='frmUsrLst' action='main.php' method='post'>
		  <input type='hidden' name='action' value='userlist' />
  		<input type='hidden' name='enabled' value='' />
		  <input type='hidden' name='Go' value='true' />
      <table border='0' class='tbl'>
      	<tr>
      		<td>&nbsp;</td>
      		<td>&nbsp;</td>
      		<td>
      			<a href='main.php?action=useradd'>
      				<img src='gfx/ico_new.png' alt='New domain' height='16' width='16' border='0'>
      			</a>
      		</td>
					<td>&nbsp;</td>
      		<td>	
      			<a href='main.php?action=useradd'>
      				<strong>Add new user</strong>
      			</a>
      		</td>
      	</tr>
      <?php
          $userlist = $mail_server->userlist($_SESSION['edit_domain']);
          usort($userlist, "vergleich");
          foreach($userlist as $user) 
					{
					  $user_name1 = $user[1];
					  $user_name1 = str_replace(".", "/.", $user_name1);
      ?>
      		<tr>
      			<td>
      				<input type='checkbox' name='check_<?php echo $user_name1; ?>'/> 
      			</td>
      			<td>
      				<a href="main.php?action=userdel&sel_user=<?php echo $user[1]; ?>" onclick="return window.confirm('Really delete user <?php echo $user[1]; ?>?')">
      					<img src='gfx/ico_delete.png' alt='Delete user' height='16' width='16' border='0'>
      				</a>
      			</td>
      			<td>	
      				<a href="main.php?action=usersel&sel_user=<?php echo $user[1]; ?>&sel_user_type=<?php echo $user[3]; ?>">
      					<img src='gfx/ico_properties.png' alt='Show properties' height='16' width='16' border='0'>
      				</a>
      			</td>
						<td>&nbsp;</td>
      			<td><?php echo $user[1]; if ($user[3] == 'M') 
						{
						  $uvars = $mail_server->uservars($_SESSION['edit_domain'], $user[1]);
							if (in_array(array("ClosedML", "1"), $uvars))
							  echo"  [closed mailing list]"; 
							else 
							  echo"  [mailing list]"; 
						}	?></td>
      		</tr>
      	<?php } ?>
      		<tr heigth="50">
      		</tr>
      		<tr>
      			<td><input type='checkbox' name='empty' disabled checked/></td>
						<td>-&gt;</td>
      			<td>&nbsp;</td>
      			<td>&nbsp;</td>
      			<td><input type='submit' name='ask_del_marked' value=' Delete selected users ' /></td>
      		</tr>
				</table>
		</form>
		<? echo "<br>&nbsp;&nbsp;&nbsp;<strong>".count($userlist)." users in domain</strong>"?>

<?php
  } else
	if (isset($_REQUEST['ask_del_marked']) && $_REQUEST['ask_del_marked'])
	{
?>	
  <p><strong>You are about to delete the following mail users:</strong></p>
<?php
	  $was_deleted = false;
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
				$var = substr($var, 6);
				$var = str_replace("/_", ".", $var);
				echo $var."@".$_SESSION['edit_domain']."<br>";
				$was_deleted = true;
			}
		}
		if (!$was_deleted)
		{
      echo "No users selected.<br>";
		}
?>
	<p>Do you really want to delete these users?</p>

	<form action='main.php' method='get'>
	  <input type='hidden' name='action' value='userlist' />
<?php
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
					echo "<input type='hidden' name='".$var."' value='".$val."'/>\n";
			}
		}
?>
		<input type='hidden' name='domain' value='<?php echo $_SESSION['edit_domain']; ?>'/>
		<input type='hidden' name='Go' value='true'/>
		<input type='submit' name='del_marked' style='width: 50px;' value=' No '/>
		<input type='submit' name='del_marked' style='width: 50px;' value=' Yes '/>
	</form>
<?php
  } else
	if (isset($_REQUEST['del_marked']) && (trim($_REQUEST['del_marked']) == "Yes"))
	{	
	  $was_deleted = false;
		foreach($_REQUEST as $var=>$val)
    {
			if (ereg("check_", $var) && $val != '')
      {
				$var = substr($var, 6);
				$var = str_replace("/_", ".", $var);
				del_user($mail_server, $_SESSION['edit_domain'], $var, $enable_filters, $filter_files, $enable_IMAP);
			  $was_deleted = true;
			}
		}
		if (!$was_deleted)
		{
      echo "No users for deletion selected.<br>";
		}
	?>
	<form action='main.php' method='post'>
		<input type='hidden' name='action' value='userlist'>
		<input type='submit' name='click' style='width: 50px;' value=' OK '>
	</form>

<?php 
  } else
	if (isset($_REQUEST['del_marked']) && (trim($_REQUEST['del_marked']) == "No"))
	{
      echo "No users deleted.<br>";
	?>
	<form action='main.php' method='post'>
		<input type='hidden' name='action' value='userlist'>
		<input type='submit' name='click' style='width: 50px;' value=' OK '>
	</form>

<?php 
	}	
} else {
  echo "<br><br><h2>Authorization failed to access this function!</h2><br><br>";
} ?>

Return current item: XMail PHP Admin Interface (XPAI)