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



if(isset($_POST[editok])) {
	$_POST[editok]=CheckInt($_POST[editok]);
	$_POST[dom_max_accounts]=CheckInt($_POST[dom_max_accounts]);
	$_POST[dom_max_space]=CheckInt($_POST[dom_max_space]);
	$_POST[space_size]=CheckInt($_POST[space_size]);
	$_POST[dom_max_files]=CheckInt($_POST[dom_max_files]);
	$_POST[dom_php_safemode]=CheckInt($_POST[dom_php_safemode]);
	$_POST[dom_php_openbasedir]=CheckInt($_POST[dom_php_openbasedir]);

	$status = true;
	echo "<BR>";

	if($_POST[dom_max_accounts]<1) {
		echo "<B><FONT COLOR=RED>Min 1 Account is requried</FONT></B><BR>";
		$status = false;
	}

	if($_POST[dom_max_space]<1) {
		echo "<B><FONT COLOR=RED>Min 1 MB Space should be allowed.</FONT></B><BR>";
		$status = false;
	}

	if($_POST[dom_max_files]<1) {
		echo "<B><FONT COLOR=RED>Min 1 File must be posible</FONT></B><BR>";
		$status = false;
	}

	if($status===true) {
		if($_POST[space_size]==2) $_POST[dom_max_space]*=1024*1024*1024;
		else $_POST[dom_max_space]*=1024*1024;
		if($_POST[dom_php_safemode]) $_POST[dom_php_safemode] = "on";
		else $_POST[dom_php_safemode] = "off";
		if($_POST[dom_php_openbasedir]) $_POST[dom_php_openbasedir] = "on";
		else $_POST[dom_php_openbasedir] = "off";

		DBQuery("UPDATE domains SET dom_max_accounts = $_POST[dom_max_accounts], dom_max_space = $_POST[dom_max_space], dom_max_files = $_POST[dom_max_files], dom_php_safemode = '$_POST[dom_php_safemode]', dom_php_openbasedir = '$_POST[dom_php_openbasedir]', dom_sys_modifydate = NOW() WHERE dom_id = $_POST[editok]");

		if($_POST[dom_php_safemode] == "on") DBQuery("UPDATE users SET user_php_safemode = 'on' WHERE user_domain = $_POST[editok]");
		if($_POST[dom_php_openbasedir] == "on") DBQuery("UPDATE users SET user_php_openbasedir = 'on' WHERE user_domain = $_POST[editok]");

		echo "<B><FONT COLOR=GREEN>Domain updated!</FONT></B><BR>";
	}
	$_POST[edit]=$_POST[editok];
}


$_POST[edit]=CheckInt($_POST[edit]);
$res = DBQuery("SELECT * FROM domains WHERE dom_id = $_POST[edit]");
$row = mysql_fetch_assoc($res);

if(($_POST[edit]>0)&&($row[dom_id]>0)) {
	$row[dom_max_space]/=(1024*1024);
	$space_size = 1;
	if(fmod($row[dom_max_space],1024)==0) {
		$row[dom_max_space]/=1024;
		$space_size = 2;
	}

	echo "<BR>";
	echo "<FORM METHOD=POST STYLE='display:inline;'>";
	echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3>";
		echo "<TR>";
			echo "<TD>Domain Name</TD>";
			echo "<TD>$row[dom_name]</TD><TD><INPUT TYPE=HIDDEN NAME=editok VALUE=$row[dom_id]><INPUT TYPE=image SRC='icons/edit.gif' STYLE='border:0px;background-color:transparent;' ALIGN=middle ALT='Modify this Domain'></TD>";
		echo "</TR>";

		echo "<TR>";
			echo "<TD>Max Accounts</TD>";
			echo "<TD><INPUT TYPE=text NAME=dom_max_accounts VALUE=$row[dom_max_accounts]></TD>";
		echo "</TR>";

		echo "<TR>";
			echo "<TD>Max Space</TD>";
			echo "<TD><INPUT TYPE=text NAME=dom_max_space VALUE=$row[dom_max_space] STYLE='width:80px;'> <SELECT NAME=space_size>";
				if($space_size == 1) echo "<OPTION VALUE=1 SELECTED>MB</OPTION><OPTION VALUE=2>GB</OPTION>";
				else echo "<OPTION VALUE=1>MB</OPTION><OPTION VALUE=2 SELECTED>GB</OPTION>";
			echo "</SELECT></TD>";
		echo "</TR>";

		echo "<TR>";
			echo "<TD>Max Files</TD>";
			echo "<TD><INPUT TYPE=text NAME=dom_max_files VALUE=$row[dom_max_files]></TD>";
		echo "</TR>";

		echo "<TR>";
			echo "<TD>PHP Safe Mode</TD>";
			if($row[dom_php_safemode]=='on') echo "<TD><INPUT TYPE=checkbox NAME=dom_php_safemode VALUE=1 CHECKED></TD>";
			else echo "<TD><INPUT TYPE=checkbox NAME=dom_php_safemode VALUE=1></TD>";
		echo "</TR>";

		echo "<TR>";
			echo "<TD>PHP Open Base Dir</TD>";
			if($row[dom_php_openbasedir]=='on') echo "<TD><INPUT TYPE=checkbox NAME=dom_php_openbasedir VALUE=1 CHECKED></TD>";
			else echo "<TD><INPUT TYPE=checkbox NAME=dom_php_openbasedir VALUE=1></TD>";
		echo "</TR>";

	echo "</TABLE>";
	echo "</FORM>";
}


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