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

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

		$res = DBQuery("SELECT dom_id, dom_name FROM domains WHERE dom_id = $_POST[selectdom]");
		$row = mysql_fetch_assoc($res);
		if($row[dom_id]==$_POST[selectdom]) {
				DBQuery("UPDATE sessions SET ses_dom_id = $row[dom_id] WHERE ses_key = '{$_COOKIE[$_REQUEST[conf_Cookie]]}' AND ses_ip = '$_SERVER[REMOTE_ADDR]' AND ses_expiredate > NOW()");
				LoginAdmin();
			}
	}

MyHeader();


if($_POST[selectdom]>0) {
		$_POST[selectdom]=CheckInt($_POST[selectdom]);

		$res = DBQuery("SELECT dom_id, dom_name FROM domains WHERE dom_id = $_POST[selectdom]");
		$row = mysql_fetch_assoc($res);
		if($row[dom_id]==$_POST[selectdom]) {
				echo "<BR><B><FONT COLOR=GREEN>Domain '$row[dom_name]' selected!</FONT></B><BR>";
			} else echo "<BR><B><FONT COLOR=RED>Unknown Domain Selected!</FONT></B><BR>";
	}



if(isset($_POST[delete])) {
		$_POST[delete]=CheckInt($_POST[delete]);
		$res = DBQuery("SELECT dom_id, dom_name FROM domains WHERE dom_id = $_POST[delete]");
		$row = mysql_fetch_assoc($res);

		if($row[dom_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 Domain '$row[dom_name]'</TH>";
			echo "<TH><FORM METHOD=POST STYLE='display:inline;'><input type='hidden' NAME=deleteok VALUE='$_POST[delete]'><INPUT TYPE=image 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 Domain!</FONT></B><BR>";

	}


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

		$res = DBQuery("SELECT dom_id, dom_name FROM domains WHERE dom_id = $_POST[deleteok]");
		$row = mysql_fetch_assoc($res);

		if($row[dom_id]==$_POST[deleteok]) {
				DBQuery("DELETE FROM users WHERE user_domain = $row[dom_id]");
				DBQuery("DELETE FROM aliases WHERE alias_destination LIKE '%@$row[dom_name]'");
				DBQuery("DELETE FROM domains WHERE dom_id = $row[dom_id]");
				echo "<BR><B><FONT COLOR=GREEN>Domain '$row[dom_name]' deleted!</FONT></B><BR>";
			} else echo "<BR><B><FONT COLOR=RED>Unknown Domain!</FONT></B><BR>";

	}



echo "<BR>";
echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3>";
	echo "<TR STYLE='background-color: #E0E0E0;'>";
	echo "<TH>&nbsp;</TH>";
	echo "<TH>&nbsp;Name&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Accounts&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Size&nbsp;</TH>";
	echo "<TH COLSPAN=2>&nbsp;Files&nbsp;</TH>";
	echo "<TH>Safe</TH>";
	echo "<TH>Base</TH>";
	//echo "<TH>Created</TH>";
	echo "<TH>Modified</TH>";
	echo "<TH COLSPAN=2>&nbsp;</TH>";
	echo "</TR>";

	$res = DBQuery("SELECT dom_id, dom_name, dom_max_accounts, dom_max_space, dom_max_files, dom_php_safemode, dom_php_openbasedir, dom_sys_createdate, dom_sys_modifydate FROM domains ORDER BY dom_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:center;'><FORM METHOD=POST ACTION=dom_list.php STYLE='display:inline;'><input type='hidden' NAME=selectdom VALUE='$row[dom_id]'><INPUT TYPE=image SRC='icons/add.gif' STYLE='border:0px;background-color:transparent;' ALT='Go into this Domain'></FORM></TD>";

			echo "<TD STYLE='text-align:left;'>$row[dom_name]</TD>";
			echo "<TD STYLE='text-align:right;'>$row[dom_max_accounts]</TD>";
			$res2 = DBQuery("SELECT count(*) as count_x FROM users WHERE user_domain = $row[dom_id]");
			$row2 = mysql_fetch_assoc($res2);
			echo "<TD STYLE='text-align:right;'>($row2[count_x])</TD>";
			echo "<TD STYLE='text-align:right;'>" . fsizeHR($row[dom_max_space]) . "</TD>";
			$res2 = DBQuery("SELECT sum(user_ftp_quota_used) + sum(user_mail_quota_used) as count_x FROM users WHERE user_domain = $row[dom_id]");
			$row2 = mysql_fetch_assoc($res2);
			echo "<TD STYLE='text-align:right;'>(" . fsizeHR($row2[count_x]) . ")</TD>";
			echo "<TD STYLE='text-align:right;'>". fcountHR($row[dom_max_files]) . "</TD>";
			$res2 = DBQuery("SELECT sum(user_ftp_files_used) as count_x FROM users WHERE user_domain = $row[dom_id]");
			$row2 = mysql_fetch_assoc($res2);
			echo "<TD STYLE='text-align:right;'>(". fcountHR($row2[count_x]) . ")</TD>";

			if($row[dom_php_safemode]=='on') echo "<TD STYLE='text-align:center;'><IMG SRC='icons/on.gif' STYLE='border:0px;' ALT='PHP SafeMode is: On'></TD>";
			else echo "<TD STYLE='text-align:center;'><IMG SRC='icons/off.gif' STYLE='border:0px;' ALT='PHP SafeMode is: Off'></TD>";
			if($row[dom_php_openbasedir]=='on') echo "<TD STYLE='text-align:center;'><IMG SRC='icons/on.gif' STYLE='border:0px;' ALT='PHP OpenBaseDir is: On'></TD>";
			else echo "<TD STYLE='text-align:center;'><IMG SRC='icons/off.gif' STYLE='border:0px; ALT='PHP OpenBaseDir is: Off''></TD>";
 
			//echo "<TD STYLE='text-align:center;'>$row[dom_sys_createdate]</TD>";
			echo "<TD STYLE='text-align:center;'>$row[dom_sys_modifydate]</TD>";

			echo "<TD STYLE='text-align:center;'><FORM METHOD=POST STYLE='display:inline;'><INPUT TYPE=HIDDEN NAME=delete VALUE='$row[dom_id]'><INPUT TYPE=image SRC='icons/delete.gif' STYLE='border:0px;background-color:transparent;' ALT='Delete this Domain'></FORM></TD>";
			echo "<TD STYLE='text-align:center;'><FORM METHOD=POST ACTION=dom_edit.php STYLE='display:inline;'><INPUT TYPE=HIDDEN NAME=edit VALUE='$row[dom_id]'><INPUT TYPE=image SRC='icons/edit.gif' STYLE='border:0px;background-color:transparent;' ALT='Modify this Domain'></FORM></TD>";
			echo "</TR>";
		}
echo "</TABLE>";






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