Location: PHPKode > projects > web-cp - Web Hosting Control Panel > webcp/web/domain/domainset.phps
<?
// If data is set (i.e the submit button has been hit)
if (isset($data)) {
	if (is_array($data)) {
		// remove spaces and slashes.
		while (list($key, $val) = each($data)) {
			if ($key != 'serverside')
				$data[$key] = trim(stripslashes($val));
		}
		
		// HARDCODED $data['uid']
		$data['id'] = $domaindata['id'];
		
		$error = domain("update",$data,$return);
		if ($error)
			echo "<br>&nbsp;&nbsp;• ".implode("<br>\n&nbsp;&nbsp;• ",$error)."<br>\n";
		else {
			// if username / skin / lang changed, display a message & reload.
			if ($data['domain'] != $domaindata['domain']
				OR $data['host'] != $domaindata['host']) {
				echo "<br><div align='center'><b>".$T['domain updated reload']."</b></div><br>
<script language='JavaScript1.3'>
<!-- 
load_url('./?cp=$cp&url=$url&number=$number&user=$user&confirm=".time()."')
// -->
</script>";
			}
			else
				echo "<br><div align='center'><b>".$T['domain updated']."</b></div><br>\n";
			
			// update $domaindata
			$domaindata = fetchdata("*","domain",$domaindata['id']);
		}
	}
}
// If we're back from a reload (i.e confirm is set), display message.
if ($confirm)
	echo "<br><div align='center'><b>".$T['domain updated']."</b></div><br>\n";
?>
<div align="center">
<form action="<?=$current_url;?>" method="post" name="webcp" onSubmit="submitonce(this);">
<table border="0" cellspacing="0" cellpadding="0"><tr><td>
<table border="0" cellspacing="0" cellpadding="0" class="tblbg">
	<tr>
		<td>
		<table border="0" cellspacing="1">
			<tr>
				<td colspan="2" class="tbltop">&nbsp;<?=$T[$cp][$url];?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['IP Address'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<?
					if ($userdata['level'] < 3)  { 
						echo '<select name="data[ip_addr]"><option value="'.$domaindata['ip'].'"> '.$domaindata['ip'].'</option>';
						
						$resellerdata = fetchdata("ip","reseller",$domaindata['id']);
						$tmp = explode(" ",$resellerdata['ip']);
						do {
							echo '<option value="'.trim(current($tmp)).'"> '.current($tmp).'</option>';
							echo "\n";
						} while(next($tmp));
	
					} else
						echo $domaindata['ip']; ?></select>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Hostname'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[hostname]" size="30" maxlength="255" value="'.$domaindata['host'].'">'; else echo $domaindata['host'];?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Domain Name'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[domain]" size="30" maxlength="255" value="'.$domaindata['domain'].'">'; else echo $domaindata['domain'];?>&nbsp;</td>
			</tr>
			<tr><? $aliases = str_replace(" ", ", ", trim($domaindata['aliases'])); ?>
				<td class="row1"><b>&nbsp;<?=$T['Hostname Aliases'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[aliases]" size="30" maxlength="255" value="'.$aliases.'">'; else echo $aliases; ?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Domain Alias'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<?
				if ($userdata['level'] < 3) {
					unset($check);
					if ($domaindata['nohost'] == 'true')
						$check['on'] = 'checked';
					else
						$check['off'] = 'checked';
					echo '&nbsp;<input type="radio" name="data[nohost]" value="true"'.$check['on'].'>'.$T['on'];
					echo '&nbsp;<input type="radio" name="data[nohost]" value="false"'.$check['off'].'>'.$T['off'];
				}
				elseif ($domaindata['nohost'] == 'true')
					echo $T['on'];
				else echo $T['off'];
				?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Catch all Aliases'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<?
				if ($userdata['level'] < 3) {
					unset($check);
					if ($domaindata['catchall'] == 'true')
						$check['on'] = 'checked';
					else
						$check['off'] = 'checked';
					echo '&nbsp;<input type="radio" name="data[catchall]" value="true"'.$check['on'].'>'.$T['on'];
					echo '&nbsp;<input type="radio" name="data[catchall]" value="false"'.$check['off'].'>'.$T['off'];
				}
				elseif ($domaindata['catchall'] == 'true')
					echo $T['on'];
				else echo $T['off'];
				?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Redirect'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<?
				if ($userdata['level'] < 3) {
					unset($check);
					if ($domaindata['redirect'] == 'true')
						$check['on'] = 'checked';
					else
						$check['off'] = 'checked';
					echo '&nbsp;<input type="radio" name="data[redirect]" value="true"'.$check['on'].'>'.$T['on'];
					echo '&nbsp;<input type="radio" name="data[redirect]" value="false"'.$check['off'].'>'.$T['off'];
				}
				elseif ($domaindata['redirect'] == 'true')
					echo $T['on'];
				else echo $T['off'];
				?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['IP Priority'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<?
				if ($userdata['level'] < 3) {
					unset($check);
					if (!$domaindata['priority'])
						$check['true'] = 'checked';
					else
						$check['false'] = 'checked';
					echo '&nbsp;<input type="radio" name="data[priority]" value="true"'.$check['true'].'>'.$T['on'];
					echo '&nbsp;<input type="radio" name="data[priority]" value="false"'.$check['false'].'>'.$T['off'];
				}
				elseif (!$domaindata['priority'])
					echo $T['on'];
				else echo $T['off'];
				?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Default Root'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<input type="text" name="data[defaultroot]" size="25" maxlength="255" value="<?=str_replace($cfg['webdir']."/".$domaindata['id'],"",$domaindata['defaultroot']);?>">&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Domain Contact'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<input type="text" name="data[email]" size="30" maxlength="255" value="<?=$domaindata['email'];?>">&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Hard Disk Space'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[hd]" size="5" maxlength="50" value="'.$domaindata['hd'].'">'; else echo $domaindata['hd']; ?> <?=$T['mb'];?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Users'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[users]" size="5" maxlength="50" value="'.$domaindata['users'].'">'; else echo $domaindata['users']; ?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Data Transfer'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[transfer]" size="5" maxlength="50" value="'.$domaindata['transfer'].'">'; else echo $domaindata['transfer']; ?> <?=$T['gb'];?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Databases'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[databases]" size="5" maxlength="50" value="'.$domaindata['db'].'">'; else echo intval($domaindata['db']); ?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Subdomains'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[subdomains]" size="5" maxlength="50" value="'.$domaindata['subdomains'].'">'; else echo intval($domaindata['subdomains']); ?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Dom Pointers'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<? if ($userdata['level'] < 3) echo '<input type="text" name="data[pointers]" size="5" maxlength="50" value="'.$domaindata['pointers'].'">'; else echo intval($domaindata['pointers']); ?>&nbsp;</td>
			</tr>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Server Side Options'];?>&nbsp;</b></td>
				<td class="row2">
				<table border="0" cellpadding="0" summary="">
				<?
				if (strstr($cfg['sslang'],",")) $sslang = explode(",",$cfg['sslang']);
				else $sslang[0] = $cfg['sslang'];
				
				// get reseller serverside [& shell] for check
				$rdata = fetchdata('serverside,shell','reseller',$domaindata['id']);
				
				$j = 0;
				while ($sslang[$j]) {
					$tmp = trim($sslang[$j]);
					unset($check);
					if ($domaindata['serverside'][$tmp])
						$check[$domaindata['serverside'][$tmp]] = ' checked';
					else
						$check['na'] = ' checked';
					
					echo "<tr><td class='row2'>&nbsp;".$T['ss'][$tmp]."&nbsp;</td><td class='small'>\n";
					
					if (($domaindata['serverside'][$tmp] == "na" AND $userdata['level'] > 2) OR $rdata['serverside'][$tmp] != "on")
						echo '&nbsp;<input type="radio" name="data[serverside]['.$tmp.']" value="na" CHECKED>'.$T['na'];
					else {
						echo '&nbsp;<input type="radio" name="data[serverside]['.$tmp.']" value="na"'.$check['na'].'>'.$T['na'];
						echo '&nbsp;<input type="radio" name="data[serverside]['.$tmp.']" value="on"'.$check['on'].'>'.$T['on'];
						echo '&nbsp;<input type="radio" name="data[serverside]['.$tmp.']" value="off"'.$check['off'].'>'.$T['off'];
					}
					echo "\n</td></tr>\n";
					++$j;
				}
			?>
			</table>
				</td>
			</tr>
			<? // Get domain data
				unset($check);
				if ($rdata['shell'] == "on" AND $userdata['level'] < 3) {
					$check[$domaindata['shell']] = ' checked';
					?>
			<tr>
				<td class="row1"><b>&nbsp;<?=$T['Shell Access'];?>&nbsp;</b></td>
				<td class="row2">&nbsp;<input type="radio" name="data[shell]" value="on"<?=$check['on'];?>><?=$T['on'];?>
				<input type="radio" name="data[shell]" value="off"<?=$check['off'];?>><?=$T['off'];?>
			</tr>
			<? } ?>
		</table>
		</td>
	</tr>
</table>
<br><div align="right"><input type="submit" value="<?=$T['Update Domain'];?>"></div>
</td></tr></table>
</form>
</div>
Return current item: web-cp - Web Hosting Control Panel