Location: PHPKode > projects > WebDebEx > webdebex/html/user_list.php
<?php
require_once("functions.php");
DBOpen();
LoginReq();
MyHeader();


if(isset($_POST[delete])) {
		$_POST[delete]=CheckInt($_POST[delete]);
		$res = DBQuery("SELECT user_id, user_name FROM users WHERE user_id = $_POST[delete]");
		$row = mysql_fetch_assoc($res);

		if($row[user_id]==$_POST[delete]) {

		echo "<BR>";
		echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3>";
			echo "<TR STYLE='background-color: #E0E0E0;'>";
			echo "<TH>&nbsp;Confirm deletion of User '$row[user_name]'</TH>";
			echo "<TH><FORM METHOD=POST STYLE='display:inline;'><INPUT TYPE=HIDDEN NAME=deleteid VALUE='$_POST[delete]'><INPUT TYPE=image NAME=deleteok SRC='icons/delete.gif' STYLE='border:0px;background-color:transparent;'></FORM>&nbsp;</TH>";
			echo "</TR>";
		echo "</TABLE>";

			} else echo "<BR><B><FONT COLOR=RED>Unknown User!</FONT></B><BR>";

	}


if(isset($_POST[deleteid])) {
		$_POST[deleteid]=CheckInt($_POST[deleteid]);

		$res = DBQuery("SELECT user_id, user_name FROM users WHERE user_id = $_POST[deleteid]");
		$row = mysql_fetch_assoc($res);

		if($row[user_id]==$_POST[deleteid]) {
				DBQuery("DELETE FROM aliases WHERE alias_destination = '$row[user_name]' ");
				DBQuery("DELETE FROM users WHERE user_id = $_POST[deleteid]");
				echo "<BR><B><FONT COLOR=GREEN>User '$row[user_name]' deleted!</FONT></B><BR>";
			} else echo "<BR><B><FONT COLOR=RED>Unknown Users!</FONT></B><BR>";

	}







if(isset($_POST[deletealias])) {
		$_POST[deletealias]=CheckString($_POST[deletealias],128);


		if($row[user_id]==$_POST[deleteid]) {
				DBQuery("DELETE FROM aliases WHERE alias_email = '$_POST[deletealias]'");
				echo "<BR><B><FONT COLOR=GREEN>Alias '$_POST[deletealias]' deleted!</FONT></B><BR>";
			} else echo "<BR><B><FONT COLOR=RED>Unknown Alias!</FONT></B><BR>";
	}





echo "<BR>";
echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3>";
	echo "<TR STYLE='background-color: #E0E0E0;'>";
	echo "<TH>&nbsp;EMail&nbsp;</TH>";
	echo "<TH>&nbsp;Name&nbsp;</TH>";

	echo "<TH>&nbsp;EMail&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Quota&nbsp;</TH>";
	echo "<TH>&nbsp;Count&nbsp;</TH>";
	echo "<TH>&nbsp;Last&nbsp;</TH>";

	echo "<TH>&nbsp;FTP&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Quota&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Files&nbsp;</TH>";
	echo "<TH>&nbsp;Count&nbsp;</TH>";
	echo "<TH>&nbsp;Last&nbsp;</TH>";

	echo "<TH>&nbsp;WWW&nbsp;</TH>";
	echo "<TH>&nbsp;SM&nbsp;</TH>";
	echo "<TH>&nbsp;OBD&nbsp;</TH>";

	echo "<TH COLSPAN=3>&nbsp;</TH>";

	echo "</TR>";

	$res = DBQuery("SELECT * FROM  users WHERE user_domain = $_REQUEST[db_session_dom] ORDER BY user_name");
	while($row = mysql_fetch_assoc($res)) {
			if($tmp_color!="#FFFFFF") $tmp_color = "#FFFFFF";
			else $tmp_color = "#E0E0E0";
			echo "<TR STYLE='background-color: $tmp_color;'>";

			echo "<TD STYLE='text-align:right;white-space:nowrap;'>".substr($row[user_name],0,strpos($row[user_name],"@"))."</TD>";
			echo "<TD STYLE='text-align:left;white-space:nowrap;'>$row[user_full_name]</TD>";

			if($row[user_mail_enabled]=='on') {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/on.gif'></TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>".fsizeHR($row[user_mail_quota_used])." /</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>".fsizeHR($row[user_mail_quota])."</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>$row[user_mail_logoncount]&nbsp;&nbsp;</TD>";
				echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_mail_lastlogon]</TD>";
			} else {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/off.gif'></TD>";
				echo "<TD STYLE='text-align:center;white-space:nowrap;' COLSPAN=4>&nbsp;</TD>";
			}

			if($row[user_ftp_enabled]=='on') {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/on.gif'></TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>".fsizeHR($row[user_ftp_quota_used])." /</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>".fsizeHR($row[user_ftp_quota])."</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>$row[user_ftp_files_used] /</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>$row[user_ftp_files]</TD>";
				echo "<TD STYLE='text-align:right;white-space:nowrap;'>$row[user_ftp_logoncount]&nbsp;&nbsp;</TD>";
				echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_ftp_lastlogon]</TD>";
			}	else {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/off.gif'></TD>";
				echo "<TD STYLE='text-align:center;white-space:nowrap;' COLSPAN=6>&nbsp;</TD>";
			}

			if($row[user_www_enabled]=='on') {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/on.gif'></TD>";
				if($row[user_php_safemode]=='on') echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/on.gif'></TD>";
				else echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/off.gif'></TD>";
				if($row[user_php_openbasedir]=='on') echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/on.gif'></TD>";
				else echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/off.gif'></TD>";
			}	else {
				echo "<TD STYLE='text-align:center;white-space:nowrap;'><IMG SRC='icons/off.gif'></TD>";
				echo "<TD STYLE='text-align:center;white-space:nowrap;' COLSPAN=2>&nbsp;</TD>";
			}


			//echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_php_safemode]</TD>";
			//echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_php_openbasedir]</TD>";


			//echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_sys_createdate]</TD>";
			//echo "<TD STYLE='text-align:center;white-space:nowrap;'>$row[user_sys_modifydate]</TD>";



			if(substr($row[user_name],0,strpos($row[user_name],"@")) != $_REQUEST[conf_adminuser]) echo "<TD STYLE='text-align:center;'><FORM METHOD=POST STYLE='display:inline;'><input type='hidden' NAME=delete VALUE='$row[user_id]'><INPUT TYPE=image SRC='icons/delete.gif' STYLE='border:0px;background-color:transparent;' ALT='Delete this User'></FORM></TD>";
			else echo "<TD>&nbsp;</TD>";
			echo "<TD STYLE='text-align:center;'><FORM METHOD=POST ACTION=user_edit.php STYLE='display:inline;'><input type='hidden' NAME=edit VALUE='$row[user_id]'><INPUT TYPE=image SRC='icons/edit.gif' STYLE='border:0px;background-color:transparent;' ALT='Modify this User'></FORM></TD>";
			echo "<TD STYLE='text-align:center;'><FORM METHOD=POST ACTION=user_alias.php STYLE='display:inline;'><input type='hidden' NAME=edit VALUE='$row[user_id]'><INPUT TYPE=image SRC='icons/add.gif' STYLE='border:0px;background-color:transparent;' ALT='Add Alias'></FORM></TD>";

			echo "</TR>";
			
			$res2 = DBQuery("SELECT alias_email, alias_destination, alias_sys_createdate FROM aliases WHERE alias_type = 'site' AND alias_destination = '$row[user_name]' ORDER BY alias_email");
			while($row2 = mysql_fetch_assoc($res2)) {
				echo "<TR STYLE='background-color: $tmp_color;'>";
					echo "<TD STYLE='text-align:right;white-space:nowrap;'>".substr($row2[alias_email],0,strpos($row2[alias_email],"@"))."</TD>";
					echo "<TD COLSPAN=16>&nbsp;</TD>";
					echo "<TD STYLE='text-align:center;'><FORM METHOD=POST STYLE='display:inline;'><input type='hidden' NAME=deletealias VALUE='$row2[alias_email]'><INPUT TYPE=image SRC='icons/delete.gif' STYLE='border:0px;background-color:transparent;' ALT='Delete this Alias'></FORM></TD>";
					echo "<TD COLSPAN=2>&nbsp;</TD>";
				echo "</TR>";
			}

		}
echo "</TABLE>";




DBClose();
MyFooter();
MyEnd();
?>
Return current item: WebDebEx